 # Default axes labels: scientific notation

Hi all,

Currently when plotting data with large numbers, the scale on each axis is
done in scientific notation, so for example you might get ticks of 1, 2, 3
then a x10^5 to indicate that it's actually 100000, 200000, 300000.

While this is a rather nice feature, I find it quite difficult to wrap my
head around numbers which aren't of the form x10^(3n). Is there some way
to change the default behaviour so that in the example above it would give
100, 200, 300 x10^3, etc?

Cheers,

Tim Leslie

Hi Tim,

Hi all,

Currently when plotting data with large numbers, the scale on each axis is
done in scientific notation, so for example you might get ticks of 1, 2, 3
then a x10^5 to indicate that it's actually 100000, 200000, 300000.

While this is a rather nice feature, I find it quite difficult to wrap my
head around numbers which aren't of the form x10^(3n). Is there some way
to change the default behaviour so that in the example above it would give
100, 200, 300 x10^3, etc?

I think your suggestion is a good one.

Try replacing ticker.ScalarFormatter._set_orderOfMagnitude with this:

def _set_orderOfMagnitude(self,range):
# if scientific notation is to be used, find the appropriate exponent
# if using a numerical offset, find the exponent after applying the offset
locs = absolute(self.locs)
if self.offset: self.orderOfMagnitude = math.floor(math.log10(range)/3)*3
else:
if locs > locs[-1]: val = locs
else: val = locs[-1]
if val == 0: oom = 0
else: self.orderOfMagnitude = math.floor(math.log10(val)/3)*3

I'm deep in the process of writing my thesis, and won't have time to test it. Would you?

Darren

···

On Monday 04 July 2005 10:26 pm, Tim Leslie wrote: