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!