How can I change number on colorbar caxis?
25 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Walter Roberson
am 17 Jan. 2018
Bearbeitet: Walter Roberson
am 22 Jul. 2019
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 Kommentare
Siehe auch
Kategorien
Mehr zu Colormaps finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!