Le mardi 15 mars 2011 à 11:30 +0100, Giovanni Luca Ciampaglia a écrit :
> Hi all,
> I call savefig by passing to it a file-like object but it appears to not 
> get the graphics format right:
> 
> f = open('not_a_pdf.pdf', 'w')
> plot([1,2,3])
> savefig(f)
> 
> but it produces a PNG image. Can anybody confirm this? I am on 
> matplotlib 0.99.3
> 
> Cheers,

You may give savefig a filename (string 'tmp.pdf') instead of the file
descriptor (file object f), or use the format keyword argument.

Automatic format selection is not handled for file object (as visible in
backend_bases.py:FigureCanvasBase.print_figure method).

-- 
Fabrice 


------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to