A second copy of a figure

I'm needing to keep two copies of a figure, with the properties
different on one copy.

However with logic like below, both copies remain the same regardless:

#I want one copy with the defaul background and one to be transparent...

    imgname = GenFilename(20)+".png"
    imgsrc = "../dynamic/"+imgname
    if kml == 1:
        fig1 = fig
        fig1.frameon = False
        fig1.figurePatch.set_alpha(0.0)
        imgname1 = imgname[:-4] + "-kml.png"
        imgsrc1 = "../dynamic/"+imgname1
        fig1.savefig(imgsrc1,dpi=100,transparent=True)
    fig.savefig(imgsrc,dpi=100)

So, it appears that fig1=fig doesn't make a copy, but rather links
these figures. Is there a way to make a true separate figure that
will allow me to alter properties in the new copy without altering the
original.

Thanks!

Bruce

···

---------------------------------------
Bruce W. Ford
Clear Science, Inc.
bruce@...2905...
http://www.ClearScienceInc.com
Phone/Fax: 904-379-9704
8241 Parkridge Circle N.
Jacksonville, FL 32211
Skype: bruce.w.ford
Google Talk: fordbw@...287...

def make_my_figure():
     fig = plt.figure()
     ...
     return fig

fig1 = make_my_figure()
fig2 = make_my_figure()

Alan Isaac

···

On 2/23/2010 12:03 PM, Bruce Ford wrote:

Is there a way to make a true separate figure that
will allow me to alter properties in the new copy without altering the
original.

Bruce Ford wrote:

I'm needing to keep two copies of a figure, with the properties
different on one copy.

However with logic like below, both copies remain the same regardless:

#I want one copy with the defaul background and one to be transparent...

    imgname = GenFilename(20)+".png"
    imgsrc = "../dynamic/"+imgname
    if kml == 1:
        fig1 = fig
        fig1.frameon = False
        fig1.figurePatch.set_alpha(0.0)
        imgname1 = imgname[:-4] + "-kml.png"
        imgsrc1 = "../dynamic/"+imgname1
        fig1.savefig(imgsrc1,dpi=100,transparent=True)
    fig.savefig(imgsrc,dpi=100)

So, it appears that fig1=fig doesn't make a copy, but rather links
these figures. Is there a way to make a true separate figure that
will allow me to alter properties in the new copy without altering the
original.

Thanks!

Bruce
---------------------------------------
Bruce W. Ford
Clear Science, Inc.
bruce@...2905...
http://www.ClearScienceInc.com
Phone/Fax: 904-379-9704
8241 Parkridge Circle N.
Jacksonville, FL 32211
Skype: bruce.w.ford
Google Talk: fordbw@...287...

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options
  
Hello Bruce,

Have you tried the standard Python copy/deepcopy function?
My matplotlib knowledge is limited so there is probably a better approach, but that should work.

-- jv