I want to copy the plot and axes to another MplWidget object
**self.anotherCanvas**.canvas
I’ve tried: self.anotherCanvas.canvas**.**ax =self.whichCanvas.canvas.ax self.anotherCanvas.canvas.draw()
and self.anotherCanvas.canvas = self.whichCanvas.canvas self.anotherCanvas.canvas.draw()
the plot doesn’t seem to copy. Does any body more familiar with matplotlib have any suggestions?
This is the MplWidget Class
***************************** MplWidget *******************************
from PyQt4 import QtGui
from matplotlib.backends.backend_qt4agg
import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure class MplCanvas(FigureCanvas):
def init(self):
self.fig = Figure()
self.ax = self.fig.add_subplot(111)
FigureCanvas.init(self, self.fig)
FigureCanvas.setSizePolicy(self,
QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)
Copying a matplotlib canvas (or a figure, or an axes) is not easy. You
cannot just rebind it. You need to copy all the hierarchy of
underlying artists. Also the attributes of artists need to be adjusted
accordingly.
And best option in my opinion is just to create another canvas using
the code that created the original canvas.
Regards,
-JJ
···
On Mon, Feb 8, 2010 at 3:04 PM, <Dave.M.Tung@...2966...> wrote:
Hey folks,
my problem may be obvious, but i can't seem to copy a plot from one canvas
to another.
# I have this object where whichCanvas is an instance of MplWidget (code
shown below)
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the
business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net matplotlib-users List Signup and Options