How can I change number on colorbar caxis?
27 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Walter Roberson
le 17 Jan 2018
Modifié(e) : Walter Roberson
le 22 Juil 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 commentaires
Voir également
Catégories
En savoir plus sur Colormaps dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!