Colormap fixed middle value
显示 更早的评论
Hej all, for a pcolor plot I have built the ratio of a treatment vs. a control (A./B) and want to plot the resulting pcolor plot with colors according to their value - In this case, 0-1 should always be in a gradient from blue to white, while everything above 1 (differing maxValues) should be in a gradient white to red. Is there a way to "fix" the colorbar so that the white color will always be displayed at value 1 of my data? (or can I use 2 colormaps for this somehow?)

采纳的回答
更多回答(1 个)
Debashish Saha
2018-7-3
0 个投票
Hi Brandon, does it also work for a vector containing negative values? In my case, it seems that 0 value is not at the exact location / point of white in the color bar. Should one take the absolute of the smallest value to negate the negative number in the vector while determining the index in your code? Thanks in advance. Cheers, DS
类别
在 帮助中心 和 File Exchange 中查找有关 Color and Styling 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!