colorbar tick decimal round
31 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hung Jr Chen
le 2 Mai 2016
Commenté : hossein
le 14 Déc 2018
Hi,
I would like to round my colorbar values to 2 decimal places, is it possible?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/163185/image.png)
Like in my figure, it has 4 dicimal places, 0.0372, I would like to display to 0.04 only.
I don't know how to do that :S
I try:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/163186/image.png)
but failed.
Réponse acceptée
Azzi Abdelmalek
le 2 Mai 2016
plot(1:10)
h=colorbar
t=get(h,'Limits');
T=linspace(t(1),t(2),5)
set(h,'Ticks',T)
TL=arrayfun(@(x) sprintf('%.2f',x),T,'un',0)
set(h,'TickLabels',TL)
1 commentaire
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!