On 07/21/2010 05:26 PM, John Hunter wrote:
> On Wed, Jul 21, 2010 at 10:09 PM, Tony S Yu<tsy...@gmail.com>  wrote:
>> Wow, I don't see that at all. I'm on OS X, mpl svn HEAD (r8567), and Qt4Agg. 
>> I don't have GTK installed, so unfortunately, I can't really do a proper 
>> comparison. Here's the output I get from your modified script. I get 
>> something similar with TkAgg (unfortunately, I get an AttributeError with 
>> the macosx backend).
>
> Works on my system for tkagg and qtagg4, so the bug appears gtkagg
> specific.  Must be something in the draw vs window realized and sized
> pipeline.  It appears you are getting some bogus size info.    Wonder
> if connecting to the draw_event might help here (longshot) or if any
> any of Eric's recent work on show is impacting th behavior here.

It is not anything I changed, but it is related to when drawing occurs. 
  The following change makes it work with gtk, and keep working with qt4agg:


efir...@manini:~/temp$ diff -u tight_layout.py tight_layout_gtk.py
--- tight_layout.py     2010-07-21 20:28:16.000000000 -1000
+++ tight_layout_gtk.py 2010-07-21 20:29:05.000000000 -1000
@@ -131,6 +131,7 @@
  if __name__ == '__main__':
      import numpy as np
      np.random.seed(1234)
+    plt.ion()
      fontsizes = [8, 16, 24, 32]
      def example_plot(ax):
          ax.plot([1, 2])
@@ -164,5 +165,6 @@
          for ax in row:
              example_plot(ax)
      tight_layout()
+    plt.ioff()
      fig.savefig('tight5')
      plt.show()


I have not tracked down the reason why gtk is behaving differently; 
drawing with gtkagg is a bit convoluted. It appears that gtk is more 
efficient in delaying drawing, and in drawing only once at the end, 
while the others are less clever, and actually draw when the 
canvas.draw() method is executed.

Eric

>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Matplotlib-devel mailing list
> Matplotlib-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to