How can I orbit a plot3 via mouse while updating it?
Show older comments
I have a plot that I want to be able to orbit with my mouse while it's updating. But every update to the plot forces the plot to go back to it's default view point. Is there a way to do what I want?
Thanks in advance!
Accepted Answer
More Answers (1)
2 Comments
Dereck
on 12 Sep 2014
Geoff Hayes
on 13 Sep 2014
Strange how it slowed down over time. Was it necessary for the set(0, 'CurrentFigure', 1); inside the for loop so that it would repeat again and again?
An alternative to the deleting of the handle is to (perhaps) just replace the data at each iteration
figure(1);
% plot the first set of data outside of loop
h = plot3(X(1,:), Y(1,:), Z(1,:));
for k=2:100000
set(h,'XData',X(k,:),'YData',Y(k,:),'ZData',Z(k,:));
drawnow;
pause(0.1);
end
So we plot the first set (k==1) initially so that we can get the handle to the 3D plot graphics object. And then on each subsequent iteration of the for loop, we just replace the X,Y, and Z data.
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!