Hello Tony, thanks a lot for the code, I'll try it out !
Regards, Erik On Fri, 2010-09-17 at 09:46 -0400, Tony S Yu wrote: > On Sep 17, 2010, at 8:58 AM, Erik Janssens wrote: > > > Hi, > > > > I'm using matplotlib in a pyqt context, as described > > in the book 'Matplotlib for python developers'. > > > > When the window is large enough, everything works > > fine, but when the window is too small part of > > the x-axis labels get chopped. > > > > Is there a way to prevent this ? Preferable > > in combination with the user being able to > > resize the window. > > > > Thanks a lot, > > > > Erik > > > Hi Erik, > > Last I checked there was nothing automatic for adjusting the spacing around > subplots. You can do so manually using ``plt.subplots_adjust`` (see for > example, > http://matplotlib.sourceforge.net/examples/pylab_examples/subplots_adjust.html). > > A while back, I wrote some functions to calculate a good set of parameters > for subplots_adjust (see attached; examples in if-main block at bottom). I've > been using these functions pretty regularly, and it works pretty well for my > purposes. > > Best, > -Tony > > Some usage notes: > > The function has to draw the figure a couple of times to calculate correct > spacing. When redrawing the figure (e.g. when you resize the window), you'd > have to re-call the function, which would redraw the figure a couple of times > before drawing the final figure. That's all to say: this is a fairly slow > function. If you don't have subplots (like in your example), you can call > "layout.tight_borders()" (instead of "layout.tight()"), which only requires a > single redraw. > > When I originally posted this to the developers list, the functions didn't > work with the GtkAgg backend. As far as I know, this hasn't changed. It > should work fine for Qt4Agg, macosx, and TkAgg backends. > > ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users