From: Ray S. <rj...@bl...> - 2004-08-30 22:09:28
|
Hi all, I've been looking at matplotlib, as I'm using wxPyPlot and want a bit more... Q1: Has anyone used matplotlib with Boa, and, as a Plug-in? Q2: In the code below, (and with/from the example) I'm trying to simply display a plot, no toolbar, sizer etc. The canvas appears on the panel, but no plot appears. What am I missing? Python 2.2 WX 2.4 Thanks, Ray wxFrame1.py: _____________________________________________________________ #Boa:Frame:wxFrame1 from wxPython.wx import * from wxPyPlot.wxPyPlot import PlotCanvas import numarray import matplotlib matplotlib.use('WX') from matplotlib.backends.backend_wx import FigureCanvasWx from matplotlib.figure import Figure from matplotlib.axes import Subplot def create(parent): return wxFrame1(parent) [wxID_WXFRAME1, wxID_WXFRAME1PANEL1, ] = map(lambda _init_ctrls: wxNewId(), range(2)) class wxFrame1(wxFrame): def _init_ctrls(self, prnt): # generated method, don't edit wxFrame.__init__(self, id=wxID_WXFRAME1, name='', parent=prnt, pos=wxPoint(0, 0), size=wxSize(406, 341), style=wxDEFAULT_FRAME_STYLE, title="Test embedded wxFigure") self.panel1 = wxPanel(id=wxID_WXFRAME1PANEL1, name='panel1', parent=self, pos=wxPoint(0, 0), size=wxSize(398, 314), style=wxTAB_TRAVERSAL) def __init__(self, parent): self._init_ctrls(parent) self.fig = Figure((5,4), 75) self.canvas = FigureCanvasWx(self.panel1, -1, self.fig) self.plot_data() def plot_data(self): a = Subplot(self.fig, 111) t = numarray.arange(0.0,3.0,0.01) s = numarray.sin(2*numarray.pi*t) c = numarray.cos(2*numarray.pi*t) a.plot(t,s) a.plot(t,c) |