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)

self.whichCanvas.canvas.ax.plot(xData, yData, 'bo', linewidth=1.5, linestyle='-')




# 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)




class MplWidget(QtGui.QWidget):

def __init__(self, parent = None):
QtGui.QWidget.__init__(self, parent)
self.canvas = MplCanvas()
self.vbl = QtGui.QVBoxLayout()
self.vbl.addWidget(self.canvas)
self.setLayout(self.vbl)



Regards,
Dave Tung

cell: 925-321-6657
office: 510-353-4770
dave.m.tung@seagate.com