|
From: C M <cmp...@gm...> - 2010-12-14 19:13:40
|
On Thu, Sep 30, 2010 at 7:55 AM, Jae-Joon Lee <lee...@gm...> wrote: > On Thu, Sep 23, 2010 at 10:31 AM, C M <cmp...@gm...> wrote: > > Until a more permanent solution is figured out, can anyone recommend > > any workarounds, even if they are a little clunky? I'm embedding mpl > > plots in wxPython and am also finding this issue suboptimal. > > > > Che > > > > A (partial) workaround is possible using the axes_grid1 toolkit (i.e., > you need matplotlib 1.0). > Attached is a module I just cooked up (based on my previous attempt @ > > http://www.mail-archive.com/mat...@li.../msg18129.html > ), > and it seems to work quite well. > The usage is simple. > > > ax = plt.axes([0,0,1,1]) > > ax.set_yticks([0.5]) > ax.set_yticklabels(["very long label"]) > > make_axes_area_auto_adjustable(ax) # This is where axes_grid1 comes > in > > Then, the axes area(including ticklabels and axis label) will be > automatically adjusted to fit in the given extent ([0, 0, 1, 1] in the > above case). > > While this is mainly for a single axes plot, you may use it with > multi-axes plot (but somewhat trickier to use). A few examples are > included in the module. > > Regards, > > -JJ > This thread is a few months old now, but I just wanted to mention that I am using JJ's workaround (thanks!) in my app--with either one or two y axes--and it is just excellent. This should definitely be at least an option for matplotlib users--the quality of the appearance of the plots now is like night and day, because, to me, seeing a plot without its axes labels (I'm talking about in a resizable plot embedded in an application, not a static graph for inclusion in a publication) is a *major* look and feel demerit. Che |