> One thing I cannot work out is the axis number presentation.
> Cannot find any documentation about how to control the presentation of
> the axis number.
Poke around ticker.formatter
> However I would prefer it would present in enginering notation (10, 100,
> 1e3, 10e3, 100e3, 1e6, 10e6 ...etc)
The easiest is to define your own formatter. Please try the solution below.
You can use it as:
gca().xaxis.set_major_formatter(EngrFormatter(3))
#####
-------------------------------------------------------------------------
#---- --- Formatters ---
#####
-------------------------------------------------------------------------
class EngrFormatter(ScalarFormatter):
"""A variation of the standard ScalarFormatter, using only multiples of
three
in the mantissa. A fixed number of decimals can be displayed with the optional
parameter `ndec` . If `ndec` is None (default), the number of decimals is
defined
from the current ticks.
"""
def __init__(self, ndec=None, useOffset=True, useMathText=False):
ScalarFormatter.__init__(self, useOffset, useMathText)
if ndec is None or ndec < 0:
self.format = None
elif ndec == 0:
self.format = "%d"
else:
self.format = "%%1.%if" % ndec
#........................
def _set_orderOfMagnitude(self, mrange):
"""Sets the order of margnitude."""
ScalarFormatter._set_orderOfMagnitude(self, mrange)
self.orderOfMagnitude = 3*(self.orderOfMagnitude//3)
#........................
def _set_format(self):
"""Sets the format string to format all ticklabels."""
# set the format string to format all the ticklabels
locs = (N.array(self.locs)-self.offset) /
10**self.orderOfMagnitude+1e-15
sigfigs = [len(str('%1.3f'% loc).split('.')[1].rstrip('0')) \
for loc in locs]
sigfigs.sort()
if self.format is None:
self.format = '%1.' + str(sigfigs[-1]) + 'f'
if self._usetex or self._useMathText: self.format = '$%s$'%self.format
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users