How can I adjust a matrix or a color map to have a gradient plus two distinct colors?
2 次查看(过去 30 天)
显示 更早的评论
I have some data that ranges from 0 to 1 inclusive. This data is on the even positions (i.e., row and column both even) of a matrix, with -1 values on the other positions. What I'd like to do is plot the matrix with imagesc, and have the -1 positions be black, the data that is exactly zero be shown in gray, and then the data >0 to be in a gradient from white to red, for example. I have made my own color map and tried adding values for black and gray at the end and adjusting the cmap range, but it seems like there's rounding going on that makes small but non-zero values of the data come out gray. Is there an easier way to do this, or is there a good explanation of how to separate distinct colors of a colormap by data?
Thanks!
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Colormaps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!