2010/10/19 Jonathan Slavin <[email protected]>:
> I think that'd be fine -- i.e. the option of \cdot or \times (though in
> the gmane preview the dot looks a bit low). In the mean time, I came up
> with the method below that worked for my purpose.
Okay thx
> import matplotlib.pyplot as plt
> import numpy as np
> from matplotlib.ticker import FuncFormatter
>
> def scinot(x,pos=None):
> if x == 0:
> s = '0'
> else:
> xp = int(np.floor(np.log10(np.abs(x))))
> mn = x/10.**xp
> # Here we truncate to 2 significant digits -- may not be enough
> # in all cases
> s = '$'+str('%.1f'%mn) +'\\times 10^{'+str(xp)+'}$'
> return s
>
> x = np.linspace(0.,2.,10)*1.E18
> y = 2.*(x/1.E18) - 1.
> fig = plt.figure()
> ax = fig.add_subplot(111)
> ax.plot(x,y)
> ax.xaxis.set_major_formatter(FucFormatter(scinot))
typo for the records although abvious: FuncFormatter
> plt.show()
Okay I can do the tedious work of changing my code ASAP but with low
priority ...
Friedrich
------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users