Multiple surface plots on a single figure
5 views (last 30 days)
Show older comments
I am trying to make several figures with multiple surface plots on each. Not using subplot or anything, just a bunch of different-colored shells overlapping each other on one figure. What I've been trying to work with is:
for c = 1:figum
figure(c)
resolution = 50;
theta = linspace(1.7, 2.6, res);
phi = linspace(-.1, 0.8, res);
[theta, phi] = meshgrid(theta, phi);
hold on
for c = 1:10
%Calculate r values based on model parameters
[x, y, z] = sph2cart(theta, phi, r);
surf(x,y,z,(ones(size(x))*c))
end
hold off
legend('1','2','3','4','5','6','7','8','9','10')
end
But all I'm getting from this is Figure 1 with the tenth surface for the last figure, and then blank figure windows for the higher numbered figures in the loop. Any ideas why it seems to be skipping my hold on commands AND my new figure commands and just overwriting everything on the first figure?
Thanks in advance!
0 Comments
Answers (1)
Walter Roberson
on 30 Jan 2012
Perhaps you want figure(c) instead of figure(fignum), since fignum is a constant?
I also recommend you read my remarks in http://www.mathworks.com/matlabcentral/answers/22208-show-figure
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!