How to delimit the number of decimal places in a colorbar?
48 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Artur M. G. Lourenço
am 18 Aug. 2012
Kommentiert: Luis Botton
am 26 Jun. 2018
In this case, for example:
contourf(peaks(60))
colormap cool
colorbar('location','southoutside')
i want 4 decimal places.
thnks in adv,
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (2)
Matt Fig
am 18 Aug. 2012
Bearbeitet: Matt Fig
am 18 Aug. 2012
Here is an example of how to do it.
contourf(peaks(60))
colormap cool
C = colorbar('location','southoutside'); % Get the handle.
% Now use the current xtick to make an xticklabel we like.
L=cellfun(@(x)sprintf('%.4f',x),num2cell(get(C,'xtick')),'Un',0);
set(C,'xticklabel',L)
Siehe auch
Kategorien
Mehr zu Colormaps 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!