Matlab colorbar peak value with exponentials

2 views (last 30 days)
Mike
Mike on 6 Jun 2012
How can I control or monitor the exponential used in my colorbar?
Context: I am displaying an image and want to superimpose numbers (data values) on the image that will correspond (ignoring the exponential) to the numbers used in the colorbar beside the image.
My problem is that when I specify the following peak values, the associated exponentials in the colorbar are used:
Max val ______ Peak exponential
1.0e-5 ______ 10 X 10^-6
1.2e-5 ______ 1.2 X 10^-5
1.5e-5 ______ 15 X 10^-6
1.6e-5 ______ 1.6 X 10^-5
When I look deeper, the transition points between showing 10^-5 and 10^-6 seem pretty arbitrary (ie. 1.2748e-5 vs 1.2749e-5 displays exponentials of 1.2X10^-5 and 12X10^-6 respectively). The code I use to control the colorbar max/min is:
bots = 0; tops = 1.0e-5;
imagesc(A,[bots tops]);
Thanks,
Mike

Answers (2)

Walter Roberson
Walter Roberson on 6 Jun 2012
The only way to control the exponential is to set its axes tick labels manually. (A colorbar is actually an extra axes with a simple graphic drawn on it.)
  1 Comment
Mike
Mike on 6 Jun 2012
I don't need to control the exponential. is there any deterministic way of finding out what exponential is or will be displayed given a peak scale value?

Sign in to comment.


Mike
Mike on 6 Jun 2012
Found an answer... I can use
cb = colorbar;
labelVals = str2num(get(cb,'yticklabel'));
and process from there.

Community Treasure Hunt

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

Start Hunting!