Hi all, I'm starting to get in matlabplot world Before
> it I tried chaco but it doesn't work in Linux, so I want to
> try this. I'm trying to develope an oscilloscope and I
> need it to embed it into a wx application. i was thinking
> in derive a class from wxScrolledWindow and create a Figure
> inside, is it possible?
Is certainly possible. Have you looked at examples/anim.py and
examples/system_monitor.py? These use GTK, but will show you how to
dynamically update your figure. Both WX and GTK have a mainloop,
which probably means you need to define an update function that
updates your plot along the lines of system_monitor, and then pass
that function to an idle handler in wx.
> I want to know something about the Class Hierarchy in
> matplotlib, from which class figure derives, which is the
> 'main' class (Figure, i hope), where is the data stored,...
I assume you are using the latest matplotlib release 0.50. In this
release, there are two important objects for you. The first is
Figure, which is what the figure command creates and it contains all
the axes, plots, etc... This has nothing to do with wx, The second is
FigureCanvasWx. In backend wx, this derives from wxPanel and so is a
wx widget. It contains your figure.
In the matlab interface, you can access all of these attributes as
manager = get_current_fig_manager()
canvas = manager.canvas # in wx mode, this is FigureCanvasWx
figure = canvas.figure # this is the backend independent Figure instance
In you oscilloscope update function, you will probably want to do
something along the lines of
lines = plot(t, y) # the initial plot at time 0
line = lines # a matplotlib.lines.Line2D instance
# get a new t, y
# this is a made up function, meaning, tell wx's idle handler to call
# update_scope every 100ms
show() # enter the wx mainloop
You don't need to use the matlab interface at all - you can work
directly with the wx widgets if you prefer. See
If you run into more trouble, post some code back here and someone can
probably help you out.