フィルターのクリア

How to delimit the number of decimal places in a colorbar?

48 ビュー (過去 30 日間)
Artur M. G. Lourenço
Artur M. G. Lourenço 2012 年 8 月 18 日
コメント済み: Luis Botton 2018 年 6 月 26 日
In this case, for example:
contourf(peaks(60))
colormap cool
colorbar('location','southoutside')
i want 4 decimal places.
thnks in adv,

採用された回答

José-Luis
José-Luis 2012 年 8 月 18 日
編集済み: José-Luis 2012 年 8 月 18 日
contourf(peaks(60))
colormap cool
h=colorbar('location','southoutside');
yt=get(h,'XTick');
set(h,'XTickLabel',sprintf('%2.4f|',yt));
Cheers!
  2 件のコメント
Matt Fig
Matt Fig 2012 年 8 月 18 日
Nice, Jose! I always seem to forget about the | option with these things.
José-Luis
José-Luis 2012 年 8 月 18 日
:)

サインインしてコメントする。

その他の回答 (2 件)

Matt Fig
Matt Fig 2012 年 8 月 18 日
編集済み: Matt Fig 2012 年 8 月 18 日
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)

Artur M. G. Lourenço
Artur M. G. Lourenço 2012 年 8 月 18 日
OWW, thank you guys!!!

カテゴリ

Help Center および File ExchangeColormaps についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by