|
From: Jonathan S. <js...@cf...> - 2010-10-19 19:42:47
|
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.
Jon
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))
plt.show()
On Tue, 2010-10-19 at 15:30 -0400, David Pine wrote:
> I like the times symbol but others prefer the dot (which I missed in the gmane preview!). So I like your suggestion of providing an option to use either \cdot or \times.
>
> David
>
> On Oct 19, 2010, at 3:23 PM, Friedrich Romstedt wrote:
>
> > What about inserting \cdot, that's the scientific notation I do prefer?
> >
> > If I'm not mistaken that's what I did that time, might be unreadable
> > in the preview? I checked, when you look close you see the dot in
> > gmane preview.
> >
> > We can make this customisable, with \times as an alternative option.
> >
> > Friedrich
>
--
______________________________________________________________
Jonathan D. Slavin Harvard-Smithsonian CfA
js...@cf... 60 Garden Street, MS 83
phone: (617) 496-7981 Cambridge, MA 02138-1516
cell: (781) 363-0035 USA
______________________________________________________________
|