Change color of numbers at colorbar

27 Ansichten (letzte 30 Tage)
Tim Dwertmann
Tim Dwertmann am 16 Jun. 2021
Bearbeitet: dpb am 17 Jun. 2021
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.

Akzeptierte Antwort

dpb
dpb am 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 Kommentare
Walter Roberson
Walter Roberson am 17 Jun. 2021
Ah!
dpb
dpb am 17 Jun. 2021
Bearbeitet: dpb am 17 Jun. 2021
I HAD tried this before I made the comment... :)
That there isn't a FontColor to go along with rest of font properties is the oversight -- not only here, but fairly globally.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 16 Jun. 2021
surf(rand(5))
colormap(turbo)
hcb = colorbar;
hcb.Ruler.TickLabelFormat = '\\color{red}%g';
The double \\ is important for this purpose.

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by