How to have different styles of mesh for matlab surfaces?
1 view (last 30 days)
Show older comments
Hi guys,
I have the below three test surfaces. I want each of the three surfaces to have the same color, but I want them distinguished based on different mesh style or line style or pattern? is it possible?
Thank you
x = [0:0.50:5];
y = {0:0.50:2; 2:0.50:3.5; 3.5:0.50:5};
Test1 = @(x,y)(x+y);
Test2 = @(x,y)(2.*x+y);
Test3 = @(x,y)(3.*x+y);
[X1,Y1] = meshgrid(x,y{1});
[X2,Y2] = meshgrid(x,y{2});
[X3,Y3] = meshgrid(x,y{3});
Z1 = Test1(X1,Y1);
Z2 = Test2(X2,Y2);
Z3 = Test3(X3,Y3);
figure(1)
s1 = surf(X1,Y1,Z1);
hold on
s2 = surf(X2,Y2,Z2);
s3 = surf(X3,Y3,Z3);
hold off
set(s1,'FaceColor',[0.9 1 1],'edgecolor',[0.9 1 1]);
set(s2,'FaceColor',[0.9 1 1],'edgecolor',[0.9 1 1]);
set(s3,'FaceColor',[0.9 1 1],'edgecolor',[0.9 1 1]);
0 Comments
Answers (1)
pfb
on 27 Apr 2015
uhm, mesh style should be easy, provided you do not use the same color for the faces and the mesh. I'm using black here.
set(s1,'FaceColor',[0.9 1 1],'edgecolor',[0 0 0],'LineStyle','-');
set(s2,'FaceColor',[0.9 1 1],'edgecolor',[0 0 0],'LineStyle','--');
set(s3,'FaceColor',[0.9 1 1],'edgecolor',[0 0 0],'LineStyle',':');
0 Comments
See Also
Categories
Find more on Surface and Mesh Plots 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!