フィルターのクリア

Title for a color bar

162 ビュー (過去 30 日間)
Mathan
Mathan 2022 年 4 月 6 日
コメント済み: Voss 2022 年 4 月 6 日
Hi,
I have been trying to add title to my colorbar using the following lines of code:
col=colorbar;
colorbar('XTickLabel', {'10^{10}', '10^{11}', '10^{12}'}, 'XTick',log10(1e10):1:log10(1e12));
caxis([log10(1e10) log10(1e12)])
ylabel(col,'My Title')
It however gives me a colorbar without the title. I then changed the position of the codes as:
colorbar('XTickLabel', {'10^{10}', '10^{11}', '10^{12}'}, 'XTick',log10(1e10):1:log10(1e12));
caxis([log10(1e10) log10(1e12)])
col=colorbar;
ylabel(col,'My Title')
and this time it gives me the colorbar with the title but the xticks are not what I had mentioned.
Wondering what I am doing wrong here and why changing the sequence of codes have such a dramtic effect.
Thanks.

採用された回答

Voss
Voss 2022 年 4 月 6 日
col = colorbar('XTickLabel', {'10^{10}', '10^{11}', '10^{12}'}, 'XTick',log10(1e10):1:log10(1e12));
caxis([log10(1e10) log10(1e12)])
ylabel(col,'My Title')
  4 件のコメント
Mathan
Mathan 2022 年 4 月 6 日
Wow - thank you for the detailed answer. Makes perfect sense.
Thanks once again!
Voss
Voss 2022 年 4 月 6 日
Happy to help!

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by