Although this has been a big improvement, there is a lingering issue
that I want to get around to cleaning up now.
When I use this workaround that Jae Joon provided, it works just fine
except that if I call canvas.draw() (because I am adding a star to a
particular marker when point picking), it causes the whole canvas to
"jump" a little bit.
What happens is that on the first call to .draw() the plot area
increases vertically a tiny amount and the title moves up slightly.
On subsequent calls, the plot surface doesn't increase vertically but
the title text moves slightly up and then down quickly. This happens
each time I point pick for the first 5 or so times, and then it stops
doing it. I don't even have to add any new points to the plot, just
call canvas.draw() and it will do this.
It is visually distracting and a look and feel demerit for the app for sure.
I've tried to make a sample that is not embedded in wxPython but so
far I can't reproduce the problem.
Jae Joon or anyone, any ideas about why this is occurring and how to
prevent it? If need be I will try to work up a sample that
demonstrates it, but so far I've failed in that.
On Thu, Sep 30, 2010 at 7:55 AM, Jae-Joon Lee <lee.j.joon@...287...> wrote:
On Thu, Sep 23, 2010 at 10:31 AM, C M <cmpython@...287...> 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.
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 @
and it seems to work quite well.
The usage is simple.
ax = plt\.axes\(\[0,0,1,1\]\)
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
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.