Plot multiple surfaces on same plot with different color for each surface
218 次查看(过去 30 天)
显示 更早的评论
Hi. I have to superimpose several surfaces on the same plot, something like:
surf(X1,Y1,Z1); hold on
surf(X2,Y2,Z2); hold on
surf(X3,Y3,Z3); hold on
... etc
This shows all surfaces with the same color scheme. I would like to show each surface with a different color map. Does anybody have suggestions? Many thanks.
1 个评论
Anant Gairola
2016-11-13
I have the same question. Did you find an answer? I have three surface plots, one on each xy, xz and yz planes. I want a different color bar scheme for each surface plot.
回答(2 个)
Sean de Wolski
2012-5-18
Like this:
figure;hold on
[xx yy] = meshgrid(1:10);
colormap([1 0 0;0 0 1]) %red and blue
surf(xx,yy,rand(10),ones(10)); %first color (red)
surf(xx,yy,rand(10)+10,ones(10)+1); %second color(blue)
view(17,22)
?
0 个评论
Wagih Abu Rowin
2021-2-15
You can specify the color for each surface individually like:
close all
figure;
%surf 1
surf(peaks+5,'FaceLighting','gouraud',...
'MeshStyle','column',...
'SpecularColorReflectance',0,...
'SpecularExponent',5,...
'SpecularStrength',0.2,...
'DiffuseStrength',1,...
'AmbientStrength',0.4,...
'AlignVertexCenters','on',...
'LineWidth',0.2,...
'FaceAlpha',0.2,...
'FaceColor',[0.07 0.6 1],...
'EdgeAlpha',0.2);
hold on
%surf 2
surf(peaks,'SpecularExponent',1,...
'SpecularStrength',1,...
'DiffuseStrength',1,...
'AmbientStrength',0.4,...
'FaceColor',[0.5 0.5 .5],...
'AlignVertexCenters','on',...
'LineWidth',0.2,...
'EdgeAlpha',1);
The results look like this:
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!