Two patches in one figure
16 views (last 30 days)
Show older comments
Hi,
please I'm trying to make two patches in one figure, after plotting the first one it disappears and I get the second one 'disk2' only. I've tried 'hold on' but it doesn't work
basically I've this piece of code for plotting
for ii=1:length(y)
set(disk1, 'xdata', xcirc1(:,ii), 'ydata', ycirc1(:,ii), 'zdata', zcirc1(:,ii));
set(disk2, 'xdata', xcirc2(:,ii), 'ydata', ycirc2(:,ii), 'zdata', zcirc2(:,ii));
drawnow
pause(0.01)
end
Any one could please give me suggestion for solving it.
Thank you.
4 Comments
Star Strider
on 5 Mar 2017
How do you calculate the ‘xcirc’, ‘ycirc’, and ‘zirc’ vectors? What are you plotting?
What do you want your plot to show?
Accepted Answer
Jan
on 6 Mar 2017
It should work. Please try it again:
axes('nextplot, 'add'); % Like "hold on"
disk1 = patch('xdata', xcirc1(:,1), 'ydata', ycirc1(:,1), 'zdata', zcirc1(:,1));
disk2 = patch('xdata', xcirc2(:,1), 'ydata', ycirc2(:,1), 'zdata', zcirc2(:,1));
for ii = 1:length(y)
set(disk1, 'xdata', xcirc1(:,ii), 'ydata', ycirc1(:,ii), 'zdata', zcirc1(:,ii));
set(disk2, 'xdata', xcirc2(:,ii), 'ydata', ycirc2(:,ii), 'zdata', zcirc2(:,ii));
drawnow
pause(0.01)
end
If the coordinates are not Inf or NaN and are within the axes limits and the view direction is not parallel to the planes of the circles, the patches must be visible.
More Answers (0)
See Also
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!