add units to colorbar TickLabels (format)

65 ビュー (過去 30 日間)
Emanuel Valdes
Emanuel Valdes 2018 年 8 月 22 日
コメント済み: Emanuel Valdes 2018 年 8 月 23 日
I'm trying to add percentage signs to TickLabels in colorbar
Here's my code:
contourf(peaks)
c = colorbar;
c.TickLabelFormat = '%g%%'
yet the next message appears: "No public property TickLabelFormat exists for class matlab.graphics.illustration.ColorBar"
I know you can set the scale value with symbols manually as it's explained here:
https://www.mathworks.com/help/matlab/creating_plots/change-colorbar-width.html
but I would like add the symbol to any value the colorbar takes. It should look like this:
I would really appreciate any help you could give me. Thanks!

採用された回答

jonas
jonas 2018 年 8 月 22 日
編集済み: jonas 2018 年 8 月 22 日
c = colorbar;
c.Ruler.TickLabelFormat='%g%%'
  1 件のコメント
Emanuel Valdes
Emanuel Valdes 2018 年 8 月 23 日
Thanks a lot Jonas!!!

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

その他の回答 (1 件)

dpb
dpb 2018 年 8 月 22 日
c.Ruler.TickLabelFormat='%g%%';
Unfortunately, you can only know about this by using Yair's function to discover undocumented/hidden properties UNDOCUMENTED
  1 件のコメント
Emanuel Valdes
Emanuel Valdes 2018 年 8 月 23 日
Thank you @dpb! indeed, it's very difficult to find that property

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

カテゴリ

Help Center および File ExchangeGrid Lines, Tick Values, and Labels についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by