How can I set the colorbar for a specific series of value ?

1 回表示 (過去 30 日間)
wenhao yang
wenhao yang 2021 年 8 月 25 日
コメント済み: wenhao yang 2021 年 8 月 25 日
Just like the color bar in this figure. When I save this figure, the color bar shows (500 1000 1500 2000).
I want the color bar to show like this [300:600:900:1200:1500:1800:2100].

採用された回答

Simon Chan
Simon Chan 2021 年 8 月 25 日
Adjust the Limits and Ticks as follows:
cb = colorbar
cb.Limits = [300 2100];
cb.Ticks=300:300:2100;
  4 件のコメント
Simon Chan
Simon Chan 2021 年 8 月 25 日
Then, you need to change the TickLabels as follows:
oldLabel = cb.TickLabels;
cb.TickLabels = cellfun(@(x) sprintf('%.1f',str2double(x)),oldLabel,'UniformOutput',false);
wenhao yang
wenhao yang 2021 年 8 月 25 日
thank you so much~

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

その他の回答 (0 件)

カテゴリ

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