|
From: Jae-Joon L. <lee...@gm...> - 2010-09-30 11:55:31
|
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 |