Hi all
I get a rather strange scaling / choice of y-axis ticks for the following script:
import pylab as pl
some_points = [0.94589396231920286, 0.94593953605915637, 0.94601787712257401, 0.94597530431819743, 0.9459922123931529, 0.94622433138703055]
pl.plot(some_points, ‘.-’)
pl.savefig(‘some_point2.pdf’)
output here:
http://dl.dropbox.com/u/2244215/some_point2.pdf
This is a rather simple plot, but matplotlib choses a strange scaling of the y-axis by default. How do I get a more standard scaling without specifying the yticks manually?
Best
Per
Hi Per,
I think you want to use the ‘ticklabel_format’ method:
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.ticklabel_format
Here’s your example modified some. ‘some_point2A.pdf’ produces exactly the same as the default. ‘some_point2B.pdf’ does not use an offset, and maybe produces more of what you were looking for.
import pylab as pl
some_points = [0.94589396231920286, 0.94593953605915637, 0.94601787712257401, 0.94597530431819743, 0.9459922123931529, 0.94622433138703055]
pl.plot(some_points, ‘.-’)
pl.ticklabel_format(style=‘plain’,useOffset=0.9458,axis=‘y’)
pl.savefig(‘some_point2A.pdf’)
pl.ticklabel_format(style=‘plain’,useOffset=False,axis=‘y’)
pl.savefig(‘some_point2B.pdf’)
-Yann
···
On Wed, Jan 18, 2012 at 4:15 AM, Per Nielsen <evilper@…287…> wrote:
Hi all
I get a rather strange scaling / choice of y-axis ticks for the following script:
import pylab as pl
some_points = [0.94589396231920286, 0.94593953605915637, 0.94601787712257401, 0.94597530431819743, 0.9459922123931529, 0.94622433138703055]
pl.plot(some_points, ‘.-’)
pl.savefig(‘some_point2.pdf’)
output here:
http://dl.dropbox.com/u/2244215/some_point2.pdf
This is a rather simple plot, but matplotlib choses a strange scaling of the y-axis by default. How do I get a more standard scaling without specifying the yticks manually?
Best
Per
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users