Savefig Question

Hi,

I use the followng function for my application:

def OnSaveAs(self, event):

dlg = wx.FileDialog(self, ‘Choose a Filename’, os.getcwd(), ‘’, ‘.png’, wx.SAVE | wx.OVERWRITE_PROMPT)

if dlg.ShowModal() == wx.ID_OK:

savename = dlg.GetPath()

self.page_graph.figure.savefig(savename)

dlg.Destroy()

This seems to work, but when I open the resulting PNG, only the figure is saved without the graph … But when I use the save button from the figure itself, the result is fine, the figure is save with the graph. So I can just removed that function, but I am curious, why it does not work as expected. Any ideas, what my mistake is?

Cheers,

Sebi

It’s hard to say from the code snippet, but I would track down
whether self.page_graph.figure is the figure that you think it is.
It could be a Figure object without any axes on it.

Cheers,
Mike
···

http://p.sf.net/sfu/splunk-d2d-c2


Matplotlib-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/matplotlib-users