Change color of numbers at colorbar
26 views (last 30 days)
Show older comments
Hey, is there a way to change the color of the written numbers at the colorbar? I don´t want to chance the colormap, just the color of the numbers at the color axis.
0 Comments
Accepted Answer
dpb
on 16 Jun 2021
Undocumented property -- underneath is a NumericRuler object which does control the axes ticklabels independently.
figure
surf(rand(5))
colormap(turbo)
hcb = colorbar;
hcb.Ruler.Color='b';
yields
And, you can set
hcb.Color='r';
afterwards and not destroy the label colors but change the box outline only.
I've railed over and over about the penchant for hiding properties that TMW seems to get more and more enamored with...
5 Comments
More Answers (1)
Walter Roberson
on 16 Jun 2021
surf(rand(5))
colormap(turbo)
hcb = colorbar;
hcb.Ruler.TickLabelFormat = '\\color{red}%g';
The double \\ is important for this purpose.
0 Comments
See Also
Categories
Find more on Colorbar in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!