MATLAB: Text in colorbar display

colorbar

Hi: I have a contour plot and a colored with a colorbar, but the exponential is inside the plot, is there anyway to refine it, for example, move it after the numbers? as shown in the figure?
Thanks Yu

Best Answer

Not sure how you managed to get the above; you don't show code so we can't reproduce it w/o a lot of effort. Without doing extra stuff at least here with R2017b, ML is smart enough to put the colorbar labels at the bottom so they don't interfere with the axis.
You can change that by using the underlying axis handle properties of the colorbar; they're hidden but accessible, a colorbar is simply another axis object underneath the hood.
hCB=colorbor('southoutside'); % save the colorbar handle
hCB.YAxisLocation='bottom'; % move the labels to bottom if not by default
You can also force the exponent to not be shown as the overall but as part of the tick marks--
hCB.Ruler.Exponent=0; % set Exponent for numeric ruler