## matplotlib-users

 [Matplotlib-users] Number of decimal places From: Nils Wagner - 2012-02-23 11:14:41 Attachments: image.png ```Hi all, How can I increase the number of decimal places in yticks ? Nils from matplotlib.ticker import ScalarFormatter formatter = ScalarFormatter(useMathText=True,useOffset=False) formatter.set_scientific(True) formatter.set_powerlimits((-12,12)) print dir (formatter) import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) ax.yaxis.set_major_formatter(formatter) import numpy as np A=np.array([[ 1 , 0.000000E+00 , 5.234141E-06], [ 2 , 1.000000E+00 , 5.233310E-06], [ 3 , 2.000000E+00 , 5.232660E-06], [ 4 , 3.000000E+00 , 5.231808E-06], [ 5 , 4.000000E+00 , 5.231277E-06], [ 6 , 5.000000E+00 , 5.230664E-06], [ 7 , 6.000000E+00 , 5.230423E-06], [ 8 , 7.000000E+00 , 5.230136E-06]]) ax.plot(A[:,1],A[:,2]) plt.show() ```
 Re: [Matplotlib-users] Number of decimal places From: Eric Firing - 2012-02-23 18:18:28 ```On 02/23/2012 01:13 AM, Nils Wagner wrote: > Hi all, > > How can I increase the number of decimal places in yticks ? One way is to install mpl from git master. The ScalarFormatter handles this situation better now: In [15]: print '\n'.join([tl.get_text() for tl in ax.get_yticklabels()]) \$\mathdefault{0.0000052300}\$ \$\mathdefault{0.0000052305}\$ \$\mathdefault{0.0000052310}\$ \$\mathdefault{0.0000052315}\$ \$\mathdefault{0.0000052320}\$ \$\mathdefault{0.0000052325}\$ \$\mathdefault{0.0000052330}\$ \$\mathdefault{0.0000052335}\$ \$\mathdefault{0.0000052340}\$ \$\mathdefault{0.0000052345}\$ Eric > > Nils > > from matplotlib.ticker import ScalarFormatter > formatter = ScalarFormatter(useMathText=True,useOffset=False) > formatter.set_scientific(True) > formatter.set_powerlimits((-12,12)) > print dir (formatter) > import matplotlib.pyplot as plt > fig = plt.figure() > ax = fig.add_subplot(111) > ax.yaxis.set_major_formatter(formatter) > > import numpy as np > > A=np.array([[ 1 , 0.000000E+00 , 5.234141E-06], > [ 2 , 1.000000E+00 , 5.233310E-06], > [ 3 , 2.000000E+00 , 5.232660E-06], > [ 4 , 3.000000E+00 , 5.231808E-06], > [ 5 , 4.000000E+00 , 5.231277E-06], > [ 6 , 5.000000E+00 , 5.230664E-06], > [ 7 , 6.000000E+00 , 5.230423E-06], > [ 8 , 7.000000E+00 , 5.230136E-06]]) > > ax.plot(A[:,1],A[:,2]) > plt.show() > > > > ------------------------------------------------------------------------------ > Virtualization& Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users ```

## Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks