How to assign a colour to particular value and rest of the values have their standard colours
1 次查看(过去 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.
0 个评论
回答(1 个)
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)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Contour Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!