It's a bit of a pain:

xPix = 900
yPix = 600

xSize = 3 #inches
ySize = xSize/xPix*yPix
gcf().set_inches_size(xSize,ySize)
gcf().savefig('test.png',dpi=xSize/xPix)

You can also chance pyplot.rcParams - it's a dictionary of default values.

On 1/17/2012 12:10 PM, Keith Hughitt wrote:
I'd also be interested if anyone has a suggestion for how to save a figure such that the pixel dimensions of a subplot (e.g. an image) are set.

On Sat, Jan 14, 2012 at 8:57 AM, klo uo <klo...@gmail.com <mailto:klo...@gmail.com>> wrote:

    I browsed Google, and found mainly outdated code examples (also on
    scipy cookbook) then some 2008 posts on StackOverflow where at
    least I find some trace that matplotlib.figure.Figure has some
    instruments to change output image size, but it's in combination
    from inches and dpi set. However I just couldn't find how to tell
    my plt graph to use this matplotlib.figure.Figure settings, and
    ended editing matplotlibrc file and changing inches and DPI there

    Shouldn't be there some easier setting to set image size for
    savefig() output?

    
------------------------------------------------------------------------------
    RSA(R) Conference 2012
    Mar 27 - Feb 2
    Save $400 by Jan. 27
    Register now!
    http://p.sf.net/sfu/rsa-sfdev2dev2
    _______________________________________________
    Matplotlib-users mailing list
    Matplotlib-users@lists.sourceforge.net
    <mailto:Matplotlib-users@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/matplotlib-users




------------------------------------------------------------------------------
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
------------------------------------------------------------------------------
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

Reply via email to