Drawing on a figure, not a subplot

Hi, JJ,

Thanks for the reply.

Adding a patch to an axes does not mean it cannot be drawn outside of
axes. As far as you set (or unset) proper clip box, artists can be
drawn anywhere in the canvas regardless of the axes it belongs to.
Here is an example,

ax = subplot(111)

from matplotlib.patches import FancyArrow
p = FancyArrow(0.05, 0.5, 0.2, 0.0, width=0.01,
               length_includes_head=False,
               head_width=None, head_length=None,
               shape='full', overhang=0,
               head_starts_at_zero=False,
               transform=ax.figure.transFigure,
               clip_on=False)

ax.add_patch(p)

OK, clip boxes are new to me, I will read more. Your suggestion seems a
bit kludgy for a multi-panel plot like mine, but it looks like it might
get the job done.

> But that isn't my goal here. I want to add lines to the FIGURE,

outside

> of any Axes. Does anyone know how to accomplish this? Thanks!

Not sure what you mean here.

I'm still fairly new to the Matplotlib code, but I have some experience
with wxPython and its sizers. Making objects work correctly when they
are resized often depends on choosing the right coordinate system for
scaling.

In matplotlib, each Artist has its own coordinate space. It seemed most
logical that, for an object that is connected to the whole figure rather
than just one of its subplots, it should use the figure's coordinate
space. It appears that the "transform" keyword in your sample code
accomplishes that, though in a roundabout way.

Also, if I understand the structure of a Matplotlib.Artist object
correctly, each has a list of Artist children which gets called
recursively when one issues a draw command for the parent. Suppose
that, after defining my plot, I should delete the one subplot that
contains my FancyArrows, which happened to be drawn outside of that
subplot's normal clip box? The FancyArrows would be deleted along with
the subplot.

If defining the object hierarchy correctly is a sample matter of adding
an Artist object of the desired type into the object's list of children,
I would try this. Given that there are very specific methods like
Figure.text(), Figure.add_subplot(), etc., I suspected that it might be
more involved than that. These might just be convenience methods.

···

On Sat, 2011-09-17 at 23:04 +0900, Jae-Joon Lee wrote:

On Sat, Sep 17, 2011 at 6:10 AM, John Ladasky > <john_ladasky@...209...> wrote: