savefig not deducing file format

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,

···

--
Giovanni L. Ciampaglia
PhD Student
University of Lugano, MACS Lab

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

···

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,

--
Fabrice

Ah, sorry for the duplicate message!

Cheers,

G

···

On 15/03/2011 11:30, Giovanni Luca Ciampaglia wrote:

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,