필터 지우기
필터 지우기

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

조회 수: 2 (최근 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 CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by