add units to colorbar TickLabels (format)

72 次查看(过去 30 天)
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 个)

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

类别

Help CenterFile Exchange 中查找有关 Blue 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by