Colorbar with equal ticks between two power exponentials
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I wanted to show a colorbar with values corresponding to equal step sizes of a certain number that is an exponent of 10 (for example if the number is 1e10 I would like to have a colorbar with ticks as 0.5e10, 1e10, 1.5e10, 2e10, 2.5e10 and 3e10).
Following is the code which I tried:
col = colorbar('XTickLabel', {'0', '0.5 x 10^{10}', '1 x 10^{10}', '1.5 x 10^{10}', '2 x 10^{10}','2.5 x 10^{10}', '3 x 10^{10}'}, 'XTick',linspace(log10(0e10),log10(3e10),7));
caxis([log10(0e10) log10(3e10)]);
but its not giving the ticks properly (attached is the plot which I get) and shows an error saying Value must be a numeric vector whose values increase.
Any advice on how to do this?
Thanks
0 commentaires
Réponse acceptée
Mathieu NOE
le 13 Avr 2022
hi
try this
figure
xt = linspace(0,log10(3e10),7);
col = colorbar('XTickLabel', {'0', '0.5 x 10^{10}', '1 x 10^{10}', '1.5 x 10^{10}', '2 x 10^{10}','2.5 x 10^{10}', '3 x 10^{10}'}, 'XTick',xt);
caxis([0 log10(3e10)]);
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Colorbar 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!