Multiple surface plots on a single figure
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Walter Roberson
2012-1-30
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
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Performance 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!