Colorbar with equal ticks between two power exponentials
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Mathan
am 13 Apr. 2022
Kommentiert: Mathieu NOE
am 14 Apr. 2022
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 Kommentare
Akzeptierte Antwort
Mathieu NOE
am 13 Apr. 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Colorbar 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!