Hi Josh,
Yes I too am using the wx backend.

Regards,
Keith

________________________________
From: Tony Yu [mailto:tsy...@gmail.com]
Sent: Friday, 13 July 2012 3:16 p.m.
To: Keith Jones
Cc: Joshua Koehler; matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] wxpython matplotlib figure resize


On Thu, Jul 12, 2012 at 9:27 PM, Keith Jones 
<k.jo...@irl.cri.nz<mailto:k.jo...@irl.cri.nz>> wrote:
Hi,
I am interested in a better solution to this problem, but I have used this 
simple method to force the right size.

    def tickle(self):
        #gets frame to redraw and resize, not elegant.
        if self.IsMaximized(): #then needs a kick
            self.Restore()
            self.Maximize()
        else:
            x,y = self.GetSize()
            self.SetSize((x-1, y-1))
            self.SetSize((x, y))

Regards,
Keith

________________________________
From: Joshua Koehler [mailto:jjkoehl...@gmail.com<mailto:jjkoehl...@gmail.com>]
Sent: Saturday, 7 July 2012 1:51 a.m.
To: 
matplotlib-users@lists.sourceforge.net<mailto:matplotlib-users@lists.sourceforge.net>
Subject: [Matplotlib-users] wxpython matplotlib figure resize

Hi all,

I am currently trying to use matplotlib with wxPython and all is going well 
except for one annoying issue that I can't figure out.

I initialize a wxcanvas object with a figure and then throughout the life of 
the program I want the canvas' figure to change and display the corresponding 
plot. I can get the change of figure, but when the program goes to plot, the 
figure isn't the right size. It changes to the right size only when I manually 
resize the figure (see attached images). Is there some command that I am 
missing? This is the update sequence I am using:

self.figure = figure

        self.canvas.figure.clear()
        self.canvas.figure = self.figure
        self.canvas.draw()
        self.color_background()

        #self.GetParent().Layout()
        #self.SetSizer(self.main_sizer)
        #self.Fit()
        self.SendSizeEvent()

As you can tell from the comments (there are more in my code), I have tried a 
variety of ways to update the figure off the bat.

Thanks!

Josh

This may be similar to a Qt-backend bug, which didn't take the toolbar into 
account when resizing the figure:
https://github.com/matplotlib/matplotlib/pull/756
It doesn't quite fit, though, because Josh's original example shows a figure 
that's the correct size (but the axes doesn't fill the figure).  The toolbar 
issue tended to squish the axes in the vertical direction (at least in the GUI 
window), whereas Josh's example is squished in the horizontal direction.

Keith: Are you also using the Wx-backend? I don't have Wx installed so I can't 
provide much help. I've been planning to take a look at a similar issue in the 
Tk backend, but haven't had time.

Best,
-Tony



________________________________

This electronic transmission and any documents accompanying this electronic 
transmission contain confidential information belonging to the sender. This 
information may be legally privileged. The information is intended only for the 
use of the individual or entity named above. If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, distribution 
or the taking of any action in reliance on or regarding the contents of this 
electronically transmitted information is strictly prohibited.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to