def initCanvas(self):
"""Initialize a new matplotlib canvas, figure and axis.
"""
self.plotPanel = wx.Panel(self)
self.plotPanel.SetBackgroundColour('white')
plotSizer = wx.BoxSizer(orient=wx.VERTICAL)
self.plotPanel.SetSizer(plotSizer)
self.fig = plt.Figure(facecolor='white')
#self.canvas = FigureCanvas(parent=self, id=wx.ID_ANY, figure=self.fig)
self.canvas = FigureCanvas(parent=self.plotPanel, id=wx.ID_ANY, figure=self.fig)
self.ax = self.fig.add_subplot(1,1,1)
self.ax.set_xlabel('Time (s)')
self.ax.set_ylabel('Frequency (Hz)')
self.cbAx = self.fig.add_axes([0.91, 0.05, 0.03, 0.93])
#self.fig.subplots_adjust(hspace=0.0, wspace=0.0,
# left=0.035, right=0.92, top=0.98, bottom=0.05)
self.adjustMargins()
self.firstPlot()
self.lastSize = (0,0)
self.needsResizePlot = True
self.canvas.Bind(wx.EVT_SIZE, self.resizePlot)
self.canvas.Bind(wx.EVT_IDLE, self.idleResizePlot)
##self.plotToolbar = widgets.PyPlotNavbar(self.canvas)
##plotSizer.Add(self.plotToolbar, proportion=0, flag=wx.EXPAND)
plotSizer.Add(self.canvas, proportion=1, flag=wx.EXPAND)
#self.plotToolbar.Hide()
评论列表
文章目录