> -----Original Message-----
> From: dugolo [mailto:mad...@gmail.com]
> Sent: Tuesday, January 12, 2010 9:21 AM
> To: matplotlib-users@lists.sourceforge.net
> Subject: [Matplotlib-users] Re using a subplot on two different figures
> 
> 
> I apologize if this has been covered, but I couldn't find it by
> searching.
> 
> I'm wondering how one might reuse a single subplot on two different
> figures.
> 
> Here's what I'm trying to do:
> 
> import matplotlib.pyplot as plt
> 
> fig1 = plt.figure()
> fig2 = plt.figure()
> ax1 = fig1.add_subplot(311)
> 
> #plot lots of stuff on ax1
> 
> # I thought maybe I could do something like this, but, of course, that
> doesn't work.
> ax2 = fig2.add_subplot(311)
> ax2 = ax1
> 
> Basically, I would like to put ax1 on both fig1 and fig2 without having
> to
> repeat all of the code for plots on ax1.

Doug,

I'm sure there's a slick, one-line way to do this. I don't know it either. As a 
quick work around, you could do this:
fig1 = plt.figure()
fig2 = plt.figure()
ax1 = fig1.add_subplot(311)
ax2 = fig2.add_subplot(311)
for ax in [ax1, ax2]:
        # do lots of stuff to ax

At least, that's how I would do it with my very basic MPL knowledge. Hope this 
wasn't obvious to you and something you were trying to avoid.

HTH,
-Paul H.

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to