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

1 Kommentar

Rik
Rik am 14 Jul. 2018
I don't know a method to actually solve this problem, but you could bodge this with at least two ways:
  1. Move the colorbar or axis position.
  2. Change the text labels, so the last text label is '2 x 10^{9}'. This has as a downside that you de-couple the labels from the values, so you can't easily change the caxis without having to redo this fix.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

dpb
dpb am 14 Jul. 2018

0 Stimmen

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

5 Kommentare

Yu Li
Yu Li am 14 Jul. 2018
Thank you, the problem solved with command: hCB.Ruler.Exponent=0;
Walter Roberson
Walter Roberson am 14 Jul. 2018
Colorbar is not an axes: it is a composite object that is associated with a peer axes and there is an overlap of properties with axes.
dpb
dpb am 14 Jul. 2018
Isn't that what I said...??? "underneath"
Walter Roberson
Walter Roberson am 14 Jul. 2018
That's like saying that a van is a car "underneath".
dpb
dpb am 14 Jul. 2018
Bearbeitet: dpb am 15 Jul. 2018
It's the key point for the Q?, though -- there is an axes inside there to mung on properties thereof.
I'd say it's more like there's a transmission "underneath" the car and/or van...and in the R2014b doc there's
Note: Starting in R2014b, the colorbar function returns a colorbar object.
In previous releases it returns an axes object.
so it's not been all that long ago the fundamental nature of colorbar being an axes was obvious to all...

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Gefragt:

am 14 Jul. 2018

Bearbeitet:

dpb
am 15 Jul. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by