How to assign a colour to particular value and rest of the values have their standard colours

6 ビュー (過去 30 日間)
Hello ,
1.I want to assign a white colour to zero value and other than zeroth value (even the value just greater than zero. ex: 0.001,0.0001 ) should carry a colour which should represent their magnitude. I have created the plot by using contourf(x,y,z) by creating the meshgrid. The problem is, it is taking same colour to all the values which are almost equal to zero.
2. I also want to hide the axis values in meshgrid and also making the graph to exactly fit to the meshgrid.
Kindly help me. .
Thanks in advance.

回答 (1 件)

Cris LaPierre
Cris LaPierre 2021 年 3 月 6 日
One solution I can think of is to replace all zeros with NaN. In a contour plot, NaNs display as white.
Z=meshgrid(-0.1:0.001:0.1);
% normal
contourf(Z)
% Change 0s to NaN
figure
Z(Z==0)=nan;
contourf(Z)

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by