I want to show zero values in white in the mesh plot so that all components with non-zero values are clearly visible.
my code is:
mesh(A) % A(1202*30)
colorbar
xlim([1 30])
I don't know how to set the colors.

댓글 수: 5

Rik
Rik 2023년 3월 8일
Have you tried using the colormap function to edit the colormap?
And if you want the values with a value of 0 to be hidden, you could consider replacing them with NaN before using mesh. That way those patches will not show up at all, instead of being white.
Rik
Rik 2023년 3월 10일
Deleted comment:
Thanks a lot.
colormap(parula(12)) wes effective for me
But colormap was effective for one of the plots and my problem is still not solved.
I can't set zero values to white
Rik
Rik 2023년 3월 10일
I recovered the removed content from the Google cache (something which anyone can do). Editing away your question is very rude. Someone spent time reading your question, understanding your issue, figuring out the solution, and writing an answer. Now you repay that kindness by ensuring that the next person with a similar question can't benefit from this answer.
This page is now archived on the Wayback Machine.
I'm really sorry, I apologize so much.
Thanks a lot.
With best regards.
Thanks a lot

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

 채택된 답변

Voss
Voss 2023년 3월 8일
Like Rik said, one option is to replace zeros with NaNs in A; then they won't show up at all (so by default you see the white axes underneath). I think this is probably the easiest option.
% random A: 60x30 matrix of integers from 0 to 5
A = randi([0 5],60,30);
% replace 0 elements with NaNs
A(A == 0) = NaN;
% create a surface
surf(A,'EdgeColor','none')
% or a mesh
% mesh(A)
% colormap, colorbar, view, grid, box
colormap(parula(12))
colorbar
view(2)
grid off
box on

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Blue에 대해 자세히 알아보기

태그

질문:

2023년 3월 8일

댓글:

2023년 3월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by