How to customize a colormap?
14 次查看(过去 30 天)
显示 更早的评论
I'm plotting a parameter with a range of 0 to 6. Several of my collaborators have been suggesting to create a colormap to go from red to blue at 1 (the critical point <1 means undersaturated, and >1 means supersaturated) to better illustrate the point.
I wonder what's the best way to achieve this within Matlab?
采纳的回答
Star Strider
2022-7-30
Another option —
cm = colormap(turbo(6));
cm = colormap(flipud(turbo(6))); % Optional
cb = colorbar;
cbtix = cb.Ticks;
cb.Ticks = linspace(min(cbtix), max(cbtix), 7);
cb.TickLabels = 0:6;
I am not certain how you want it oriented, so use the flipud function to reverse the direction of the colours (as I did here), if necessary.
.
更多回答(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!