How can I change number on colorbar caxis?
25 次查看(过去 30 天)
显示 更早的评论
My colorbar is equidistant,
I want to change the colorbar range,be a not equidistant colorbar.
Below is my colorbar.(caxis[(1500,5500)])
I want to change to like below's figure(From Internet).
How can I change the value?
Thank you.
0 个评论
回答(1 个)
Walter Roberson
2018-1-17
编辑:Walter Roberson
2019-7-22
Record the handle of the colorbar when you create it. Set the Ticks property of the handle to the list of values you want (or possibly YTicks property, depending how old your MATLAB is.)
The way to create a colorbar (or colormap) that is not uniform in step width is to calculate the greatest common divisor (GCD) of the step sizes, and then to repeat colors as many times as (step width divided by GCD). In your example your smallest width is (50-0) = 50, so you would create a table in which the first entry (0 to 50) was the first color, and the next (200-50)/50 = 3 entries were the same second color, and the next (500-200)/50 = 6 entries are the same third color, the 6 entries after that the same fourth color, the (1000-800)/50 = 4 entries after that the same fifth color, the 10 after that the same sixth color, and so on.
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!