edit color of colorbar scaling-factor

5 views (last 30 days)
Dear experts,
when using a colorbar in front of a dark background I wish to set the font color to white. Editing the Colorbar color propertiy does that nicely
mycolorbarhandle.Color = [1 1 1]
However, whenever the automatic scaling takes place, i.e. my colorbar "decides" not to display the value 13000 but instead the value 1.3 and a little "x10^4" text is added, this multiplier of x10^4 will always be displayed black, not in the font color I chose before. So far I have been unable to identify which handle is resposible for this "x10^4" text label.
Has anybody encountered a similar problem and has found a solution? I'd also appreciate siggestions on whre to find the handle for this text.
Thank you!
  1 Comment
Adam Danz
Adam Danz on 23 Apr 2019
The exponential notation changes color correctly when I try it. Try editing the color after you've made all other changes to the axes. If that doesn't help, share some reproducible code.
surf(peaks*10000000)
ch = colorbar;
ch.Color = 'r'; %change to red
190423 112204-Figure 1.jpg

Sign in to comment.

Accepted Answer

Thomas Ernst
Thomas Ernst on 25 Apr 2019
Thank you Adam, you pointed me in the right direction. :-)
Setting the right color property to white once again at the end does the trick of refreshing even the exponent color.
Turns out the program I used to generate my graphics (slover from the SPM package for neuroimaging) does not use the colorbar object at all, but instead generated a subplot axis object. Hence my exponent in question is the y-axis exponent of that object and as such does not supply a handle by MATLAB default. While the axes were created with the color set to white ( axes(...,'Ycolor',[1 1 1],...) ), the exponent will only turn white after explicitly setting the y-axis color to white once again after the figure was created and filled with data. Well...
myCbarHandle.YAxis.Color = 'w';

More Answers (0)

Categories

Find more on Colormaps in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!