Brian Blais <bblais@...1129...> writes:
and it works with pylab. But, if I use matplotlib.Figure directly in
an app, and then call:
myfig.savefig('blah.pdf') it saves it as 'blah.pdf.jpg', a jpeg file.
Sounds like you are using a backend other than the pdf one. Can you
write up a complete example of code that behaves like you describe?
···
--
Jouni K. Sepp�nen
http://www.iki.fi/jks
This is the smallest example I can write. I am embedding the figure in a wx window. In this test case, I print (successfully) a PNG and EPS, but the PDF doesn’t work (gets a .jpg attached to the end).
bb
···
On Jul 26, 2007, at Jul 26:4:49 PM, Jouni K. Seppänen wrote:
Brian Blais <bblais@…1129…> writes:
and it works with pylab. But, if I use matplotlib.Figure directly in
an app, and then call:
myfig.savefig(‘blah.pdf’) it saves it as ‘blah.pdf.jpg’, a jpeg file.
Sounds like you are using a backend other than the pdf one. Can you
write up a complete example of code that behaves like you describe?
–
Brian Blais
bblais@…1129…
http://web.bryant.edu/~bblais
#!/usr/bin/env python
import wx
from matplotlib.backends.backend_wxagg import FigureCanvasWx as FigureCanvas
from matplotlib.figure import Figure
class MainWindow(wx.Frame):
“”" We simply derive a new class of Frame. “”"
def init(self, parent, id, title):
wx.Frame.init(self, parent, id, title, size=(400,400))
fig = Figure()
canvas = FigureCanvas(self,-1, fig)
ax=fig.add_subplot(111)
ax.plot([1,2,3,4],‘o’)
canvas.draw()
self.Show(True)
fig.savefig(‘blah.eps’)
fig.savefig(‘blah.png’)
fig.savefig(‘blah.pdf’)
app = wx.PySimpleApp()
frame=MainWindow(None, wx.ID_ANY, ‘Test’)
app.MainLoop()