[SciPy-user] About alternatives to Matlab

Peter Wang pwang at enthought.com
Mon Nov 20 00:57:55 CST 2006

On Nov 20, 2006, at 12:36 AM, David Cournapeau wrote:

>> Chaco is under very active development, but I do believe it is ready
>> to be used by end users, especially if they don't mind giving much-
>> needed feedback on what docs and additional examples would be most
>> helpful. :)
> My impression was chaco was abandonned, because it was difficult to  
> find
> any information on chaco from google (but this was a few weeks, maybe
> even a few months ago). The precedent emails seem to imply I was  
> wrong,
> and I should check it further.

Hmm... Chaco currently doesn't have as much visibility as I would  
like, but the first few non-mailing-list links that google turns up  
for "chaco plotting" are:

Both are correct pages for the "current" chaco.  I've been trying to  
keep the wiki updated with developments, but (as always) the code  
moves faster than the documentation. :)

> I understand that chaco is a toolkit to build "scientific" GUI,  
> right ?

Well, it's a toolkit for building interactive visualizations, mostly  
plots.  The more traditional "GUI" things like sliders and dropdowns  
and text boxes are all done using Traits UI.

> In matlab, you can zoom, edit plots (to remove some lines, for  
> example),
> and I couldn't do that with matplotlib. Again, I cannot stress enough
> that it may just because of my laziness and lack of investigation on
> matplotlib side. Also, I would like to do things that matlab can  
> not do,
> like select data visually, and get the corresponding data back in the
> python interpreter (why matlab does not make this kind of things  
> easy is
> beyond me for such an expensive software), etc...

I don't have a plot editing demo in the chaco2/examples directory  
yet, but we have built exactly such a tool/interaction for a customer  
project, and I can easily move it over.  It lets you redraw a section  
of a line plot, or select a region and apply an arbitrary expression  
to it, among other things.

To see an example of selecting data visually, take a look at chaco2/ 
examples/scatter_select.py.  You can use your left-click and drag to  
select points.  It prints out the selection to screen, but you can  
access the LassoTool programmatically and get the list of selected  
points, listen for events (selection changed, selection complete,  
etc.), and a variety of other things.

> Something else which would be really great is a (limited) waveform
> editor, something I always dreamt of in matlab. Let's say I have a 10
> second waveform in numpy array: a widget to plot its waveform  
> (which may
> require special interpolation), zoom it horizontaly or vertically,
> select a part of to get the corresponding data...

Haha... we actually have this *exact* thing implemented as a demo:  
chaco2/examples/zoomed_plot/zoom_plot.py.  You can left click and  
drag in the upper window to zoom into a region for the lower window.   
You can then drag the selection around, or drag its borders to resize  
it.  Note that if you are not running this demo on windows (i.e. you  
are running it on Linux), then you should edit the function  
read_music_data() to return some meaningful data, since the .wav file  
it looks for doesn't exist on non-windows systems.

Eric and I put the zoom_plot demo together for a talk he was doing a  
while back (Europython, maybe?); at the time we also discussed adding  
some simple buttons like "play", "pause", etc.  It wouldn't be hard  
to do that.

I would encourage you to look at some of the other examples to get  
some idea of what Chaco can do.  Each of the examples in chaco2/ 
examples/ has a docstring at the top of the file, and there is a set  
of slides I put together for a tutorial session at SciPy '06:


More information about the SciPy-user mailing list