How to plot MESH only in black?

조회 수: 15 (최근 30일)
John
John 2014년 6월 3일
답변: Bjørn Kvamme 2020년 3월 23일
Can the 'mesh' plot be in a single color, say black, and not in color map?
Thanks.

답변 (5개)

Kelly Kearney
Kelly Kearney 2014년 6월 3일
mesh(x,y,z, 'edgecolor', 'k')

José-Luis
José-Luis 2014년 6월 3일
편집: José-Luis 2014년 6월 3일
You could set the colormap to black only, and use surf instead.
[x,y] = meshgrid([-2:.2:2]);
Z = x.*exp(-x.^2-y.^2);
surf(x,y,Z)
colormap([0 0 0])
  댓글 수: 1
José-Luis
José-Luis 2014년 6월 6일
편집: José-Luis 2014년 6월 6일
%Alternative 1
figure(1)
plot3(x,y,Z,'k-');
%Alternative 2
figure(2)
plot3(x',y',Z','k-');
Please accept an answer if it helped you.

댓글을 달려면 로그인하십시오.


John
John 2014년 6월 3일
'edgecolor' isn't a good way. It plots the "baseline" and appears very messy.
  댓글 수: 1
Kelly Kearney
Kelly Kearney 2014년 6월 3일
What do you mean? A mesh plot doesn't have a "baseline"... perhaps you're seeing an artifact of your data? Can you give an example, or post a screenshot of your plot?

댓글을 달려면 로그인하십시오.


John
John 2014년 6월 6일
Unless using 'shading interp', both mesh and surf will plot the line linking 2 lines which is not desirable.
[x,y] = meshgrid([-2:.2:2]);
Z = x.*exp(-x.^2-y.^2);
surf(x,y,Z) or mesh(x,y,Z)
colormap([0 0 0]) % with or without this, crossing lines are plot;
shading interp; % only with this the crossing lines are cleared.
% but we only want the curve lines, not the crossing lines, not shading either.
  댓글 수: 2
José-Luis
José-Luis 2014년 6월 6일
curve lines? crossing lines? It would help a lot if you showed an example of what you want to achieve.
José-Luis
José-Luis 2014년 6월 6일
I tried to interpret what you mean. Please see comment to my original answer.

댓글을 달려면 로그인하십시오.


Bjørn Kvamme
Bjørn Kvamme 2020년 3월 23일
I wanted to get this plot in shades of grey/black instead of colours but meshc does not accept "edgecolour"
load CH4_expT4
x3=CH4_expT4(:,1)
y3=CH4_expT4(:,3)
z3=CH4_expT4(:,2)
xv = linspace(min(x3), max(x3), 1000);
yv = linspace(min(y3), max(y3), 1000);
[X,Y] = meshgrid(xv, yv);
Z = griddata(x3, y3, z3, X, Y);
meshc(X,Y,Z,'edgecolor','k')
grid on
ylabel('Temperature (K)')
zlabel('Pressure (Bars)')
xlabel('time (hours)')

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by