Hi Jae-Joon, Thanks for your quick reply! Since for example LineCollections can be created independent of the Axes in which they are going to be plotted through the creation of a LineCollection instance, would it not be possible to have a method that allows one to retrieve an Axes-independent LineCollection from an Axes instance? (for example a get_collection method) This would then allow one to 'recycle' existing collections.
Cheers, Thomas On Mar 29, 2010, at 1:40 PM, Jae-Joon Lee wrote: > As far as I can say, moving around artists from one axes to the other > is NOT recommended. And I encourage you to create separate artists for > each axes rather than try to reuse the existing ones. > > For your particular example, > > fig = mpl.figure() > ax2 = fig.add_subplot(1,1,1) > for c in ax1.collections: > c._transOffset=ax2.transData > ax2.add_collection(c) > > should work. > > Regards, > > -JJ > > > > > On Mon, Mar 29, 2010 at 12:24 PM, Thomas Robitaille > <thomas.robitai...@gmail.com> wrote: >> Hello, >> >> In the following example, I am trying to copy over existing collections from >> one plot to another: >> >> import matplotlib.pyplot as mpl >> >> fig = mpl.figure() >> ax1 = fig.add_subplot(1,1,1) >> ax1.scatter([0.5],[0.5]) >> fig.savefig('test1.png') >> >> fig = mpl.figure() >> ax2 = fig.add_subplot(1,1,1) >> for c in ax1.collections: >> ax2.add_collection(c) >> fig.savefig('test2.png') >> >> However, the circle appears in the wrong place in test2.png (close to 0.4, >> 0.4 instead of 0.5,0.5). Is it not possible/safe to copy over collections in >> this way? If not, then how should this be done? >> >> Thanks, >> >> Thomas >> ------------------------------------------------------------------------------ >> 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 >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> ------------------------------------------------------------------------------ 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 https://lists.sourceforge.net/lists/listinfo/matplotlib-users