Borrar filtros
Borrar filtros

colorbar tick decimal round

31 visualizaciones (últimos 30 días)
Hung Jr Chen
Hung Jr Chen el 2 de Mayo de 2016
Comentada: hossein el 14 de Dic. de 2018
Hi,
I would like to round my colorbar values to 2 decimal places, is it possible?
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:
but failed.

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 2 de Mayo de 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 comentario
hossein
hossein el 14 de Dic. de 2018
Work 100% Perfect. Thanks. A life save ;)

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by