On Jul 26, 2007, at Jul 26:4:49 PM, Jouni K. Seppänen wrote:

Brian Blais <[EMAIL PROTECTED]> 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?


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

--
Brian Blais
[EMAIL PROTECTED]
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()


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to