Loading...

matplotlib-users@lists.sourceforge.net

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: [Matplotlib-users] assigning a plot object to a figure Eric Firing Sun Apr 01 14:00:28 2012

On 03/30/2012 01:23 PM, Emmanuel Mayssat wrote:
> Hello all,
>
> I can create a figure
> and get the corresponding axes/plots
>
> for examples:
> 1/
> fig = Figure(figsize=(width, height), dpi=dpi)
> ax = gif.add_subplot(111)
>
> 2/
> fig, ax = plt.subplots()
>
> but I would like to create my plot independently from the figure and
> assign it to a figure
>
> I code I would like to do something like this
>
> my_ax = Axes(...)
> my_ax.plot(x,y)
>
>
> ax = my_ax
>
> or
>
> my_ax.set_figure(fig)
>
> How can I create the axes/plot object independently from the figure?

As far as I can see, you can't.  The figure is deeply embedded in the 
Axes object; that's why the figure is an argument in Axes.__init__().

> Better yet, how can I assign an axe to a figure?

I don't think you can.  It looks to me like Axes.set_figure should be 
clearly marked as a private method, not to be used except in 
Axes.__init__().

Short of a major refactoring of mpl, I think you will need to find some 
other way of accomplishing your ultimate aim.

Eric

> --
> Emmanuel

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Matplotlib-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users