From: Matt N. <new...@ca...> - 2005-12-01 06:07:11
|
Dear Massimo, Sorry I wasn't able to respond sooner. I've been running experiments all day. As a warning, this response may be long, and I won't take the time to be overly polite. So let me say it now: Matplotlib is a great plotting library and John should be knighted. I was in a similar dilemma a little over a year ago when I was comfortable enough with matplotlib and its development that I knew it was what I wanted to commit to using. At that time (late summer 2004), wxmpl did not exist and many of the additions for interactivity in matplotlib did not exist. I had already decided to abandon Tkinter/Pmw.BLT plotting, but it took awhile to find a better solution. Matplotlib is it. And I definitely wanted (and still want) a wxPython plotting widget which is intended to go into applications. Much of matplotlib, and the other responses seem to fail to understand this: I (and I'm assuming you) want a plotting widget that goes into a wxPython application. I want to say something not much harder than plotpanel =3D SomeMatplotLibPanel(wx_parent_id) plotplanel.plot(x,y) And then have the user (that is *MY* user -- the person running the program, not the person writing the script) be able to change the color, change the titles, zoom in, zoom out, print, save to a PNG. MPlot tries to do this. For 2-d line plots, it does this fairly well. It may not be the best code, it certainly could use improvement.=20 Please feel free to make or suggest changes. If you (or anyone else) would like to use it or develop it, please let me know how I can help you. I'd love for it to be improved -- it really needs false color maps soon. OTOH, if something better comes along, I'll happily use it. Pylab is NOT suitable for applications. It assumes that the end user is someone who uses python. Somehow this became the higher priority for matplotlib. I think this is a terrible mistake. Seeing so many examples and questions on this mailing list assuming from pylab import * is really quite sad. To me it suggest this lovely packaged advertised as a library is not being used as a library at all. Matplotlib is far too nice to be an add-on to IPython or used only for writing quick-n-dirty scripts. wxMPL is definitely a very nice wx wrapping of MPL. My recollection is that Ken McIvor wrote wxmpl after I showed him MPlot, but I'd defer to Ken's version of the story. I'm also very happy that Ken's maintaining the wx backend. I definitely spent most of the effort in MPlot on bindings, printing, user configuration, and worrying about being able to 'stripchart' (update a trace at close to 'real time').=20 I'm sure that some of what I wrote could be replaced with wxmpl or matplotlib calls at this point. You may understand my reluctance to do this (like it works and I have my own data to analyze and applications to write), but I would not be opposed to seeing this done. I would also characterize wxMPL as being focused on the programmer/script writer, not on the end user of an application. So it's not exactly a 'wxPython Plot Widget'. But it might make the code of MPlot easier to use/manage/improve. On using matplotlib bindings and the Navigator toolbars, I'd guess you don't want to do this. The toolbars are ugly, take up screen real estate, do stuff you don't need and don't do stuff you do need. I'm sure these are fine when you're doing a quick-n-dirty plot with an 'ipython -pylab' script, but I somehow never need to do that. Using the matplotlib bindings would mean separate kinds of event handlers for a MPL Panel and a non-MPL Panels. I guess that's inevitable, but I'd still suggest sticking with straight wx.Bind methods. I don't think the MPL bindings provide anything that can't easily be reproduced, though it's been awhile since I looked at them. Since you're short on time (we all are), I suggest giving MPlot a spin and see if it does enough of what you need. I'd appreciate hearing what does and doesn't. Finally, I was very happy to see your response to the fairly silly 'use some other package', and agree completely with your sentiment. Cheers, --Matt PS: a very short wxPython / MPlot example: import wx import MPlot import matplotlib.numerix as Num x =3D Numpy.arange(0.0,10.0,0.1) y =3D Numpy.sin(2*x)/(x+2) app =3D wx.PySimpleApp() pframe =3D MPlot.PlotFrame() pframe.plot(x,y) pframe.set_title('Test Plot') pframe.set_xlabel(r'$R (\angstrom)$') pframe.write_message('MPlot PlotFrame example: Try Help->Quick Reference') pframe.Show() pframe.Raise() app.MainLoop() |