I'm new to matplotlib and python GUIs in general, so I apologize if I'm
missing something fundamental in my understanding of the matplotlib canvas -
figure - etc model. That said...
I'm working on a small matplotlib app using PyQT4. It involves selecting an
arbitrary number of data files and breaking each down into a group of 6
contour subplots. I want to be able to switch between contour plots from
each data set quickly to compare and contrast, so my thought was to
front-load the data analysis and figure creation and store them, then update
the displayed figure with a stored figure. I am not able to get the stored
figures to display though.
In attempt to debug/understand what's going on, I have the following:
class InputWindow (QtGui.QWidget):
def __init__ (self, parent=None):
self.dpi = 100
self.fig = Figure((9.0, 6.0), dpi=self.dpi)
self.canvas = FigureCanvas(self.fig)
self.vbox = QtGui.QVBoxLayout()
self.resize (900, 600)
This works fine and creates an empty plot. I can clear this figure with
self.fig.clear() and add subplots to it with self.fig.add_subplot upon
pushing a button in the UI. What I can't do is something like this:
def Process (self):
fig2 = Figure((9.0, 6.0), dpi=self.dpi)
self.fig = fig2
This will clear the figure, but it doesn't update with the contents of fig2.
If I look at the properties of self.fig, they match those of fig2 though.
Any help on what I need to do to get something like self.fig = fig2 working?
View this message in context: http://www.nabble.com/Setting-Figure-%3D-Figure-possible--tp25985129p25985129.html
Sent from the matplotlib - users mailing list archive at Nabble.com.