plt.plot and other wxPython stuff
Hello all, this is just a bit of information because I've seen similar postings in the archives. A couple of general questions at the end. I'm trying to use plt.plot in a python app which uses other wxPython stuff. I find that it is very hard to get things to play nicely. In short, if I don't import gui_thread then things go wrong. For example I get this error;
plt.axis([0,1,-100,2323]) Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/lib/python2.2/site-packages/scipy/plt/interface.py", line 178, in axis x_ticks = _active.x_axis.ticks AttributeError: axis_window instance has no attribute 'ticks'
But if I do import gui_thread, I get lots of strange behavior such as no window at all appearing or sometimes this: Xlib: unexpected async reply (sequence 0x61)! Why bother? Because as I see it, plt.plot is the best all-purpose scientific plotting code around right now for python. Though it can be a bit slow, it works, it's zoomable and, best of all, it generates decent postscript. What I would like to do is strip out the core of plot.plt and use it in a more general setting. Namely I would like to make a scipyPlotCanvas() similar to the wxPlotCanvas() [used to build scipy.plt I believe]. Then I could just drop the canvas into my app. I would be responsible for threading issues, negating the need for gui_thread. I make no promises about having time to do this. But if I do get something working I will post back. Also, pointers are gladly accepted. E.g. is chaco to the point where I could use it? I'm a research scientist with one simple need: a good, flexible plotting canvas for my python front end. Regards, Doug Eck == Dr. Douglas Eck www.idsia.ch/~doug
On Thu, Nov 21, 2002 at 09:43:56AM +0100, Douglas Eck wrote:
What I would like to do is strip out the core of plot.plt and use it in a more general setting. Namely I would like to make a scipyPlotCanvas() similar to the wxPlotCanvas() [used to build scipy.plt I believe]. Then I could just drop the canvas into my app. I would be responsible for threading issues, negating the need for gui_thread.
I make no promises about having time to do this. But if I do get something working I will post back. Also, pointers are gladly accepted.
Before spending effort on this, have a try at PyQwt (http://gerard.vermeulen.free.fr), which besides to offer zoom and postscript output, is *very* fast. You may want also have a look at: http://kmatplot.sourceforge.net/ Both requires the Qt toolkit (which is not necessarily a drawback!) Cheers, -- Francesc Alted PGP KeyID: 0x61C8C11F Scientific aplications developer Public PGP key available: http://www.openlc.org/falted_at_openlc.asc Key fingerprint = 1518 38FE 3A3D 8BE8 24A0 3E5B 1328 32CC 61C8 C11F
Thanks. It looks excellent. . . I'll give it a try. Francesc Alted wrote:
On Thu, Nov 21, 2002 at 09:43:56AM +0100, Douglas Eck wrote:
What I would like to do is strip out the core of plot.plt and use it in a more general setting. Namely I would like to make a scipyPlotCanvas() similar to the wxPlotCanvas() [used to build scipy.plt I believe]. Then I could just drop the canvas into my app. I would be responsible for threading issues, negating the need for gui_thread.
I make no promises about having time to do this. But if I do get something working I will post back. Also, pointers are gladly accepted.
Before spending effort on this, have a try at PyQwt (http://gerard.vermeulen.free.fr), which besides to offer zoom and postscript output, is *very* fast.
You may want also have a look at: http://kmatplot.sourceforge.net/
Both requires the Qt toolkit (which is not necessarily a drawback!)
Cheers,
"DE" == Douglas Eck <doug@idsia.ch> writes:
[snip] DE> What I would like to do is strip out the core of plot.plt and DE> use it in a more general setting. Namely I would like to make DE> a scipyPlotCanvas() similar to the wxPlotCanvas() [used to DE> build scipy.plt I believe]. Then I could just drop the canvas DE> into my app. I would be responsible for threading issues, DE> negating the need for gui_thread. plt is not based on wxPlotCanvas and its very easy to use directly from wxPython. I think this post might be of some use: http://www.scipy.org/site_content/mailman?fn=scipy-user/2002-August/000527.h... HTH, prabhu
Unbelievably easy. Thanks much. It's exactly what I wanted. Prabhu Ramachandran wrote:
"DE" == Douglas Eck <doug@idsia.ch> writes:
[snip]
DE> What I would like to do is strip out the core of plot.plt and DE> use it in a more general setting. Namely I would like to make DE> a scipyPlotCanvas() similar to the wxPlotCanvas() [used to DE> build scipy.plt I believe]. Then I could just drop the canvas DE> into my app. I would be responsible for threading issues, DE> negating the need for gui_thread.
plt is not based on wxPlotCanvas and its very easy to use directly from wxPython. I think this post might be of some use:
http://www.scipy.org/site_content/mailman?fn=scipy-user/2002-August/000527.h...
HTH, prabhu _______________________________________________ SciPy-user mailing list SciPy-user@scipy.net http://www.scipy.net/mailman/listinfo/scipy-user
Hi all, Douglas Eck <doug@idsia.ch> wrote:
plt.plot is the best all-purpose scientific plotting code around right now for python.
I agreee with Douglas. I've been using scipy mostly for its plt package for a couple of months now and I feel it is the most "practical" interactive plotting package for python. I use line plotting and image display most frequently and there just isn't other good packages which can handle both. But scipy/plt is still not satisfactory: - it doesn't handle nan/inf in an appropriate way, (like matlab or R does) - its image zooming is slow and memory demanding (once killed my linux box) Those were making scipy/plt a little bit "impractical", so I did some modifications, which I attached to this email. I hope someone maintaining plt package will look at them and either incorporate or reimplement them. Ken P.S. Is there anyone planning to implement multiple plots in a window for plt package? "subplot" in matlab is good enough for me, but R's layout function is really flexible and seems to be a good model to imitate.
Hi all,
Douglas Eck <doug@idsia.ch> wrote:
plt.plot is the best all-purpose scientific plotting code around right now for python.
I agreee with Douglas. I've been using scipy mostly for its plt package for a couple of months now and I feel it is the most "practical" interactive plotting package for python. I use line plotting and image display most frequently and there just isn't other good packages which can handle both.
But scipy/plt is still not satisfactory: - it doesn't handle nan/inf in an appropriate way, (like matlab or R does) - its image zooming is slow and memory demanding (once killed my linux box)
Those were making scipy/plt a little bit "impractical", so I did some modifications, which I attached to this email. I hope someone maintaining plt package will look at them and either incorporate or reimplement them.
Thanks. These sound like nice additions. I'll take a look.
P.S. Is there anyone planning to implement multiple plots in a window for plt package? "subplot" in matlab is good enough for me, but R's layout function is really flexible and seems to be a good model to imitate.
Chaco already handles this and quite a bit of other stuff (including NaN support). It is extremely flexible also, allowing for arbitrary nesting of plot groups. Chaco will become the replacement for plt at some point (probably SciPy 0.3). In the mean time, we'll try to update plt with features like yours. eric
Hi all, Chaco is looking increasingly exciting! but... I just installed the latest tar-ball from the website (0.1.0-alpha-5.379) and the setup.py fails with "import error: module chaco_version not found". Presumably there's a file missing from this distribution. Removing the chaco_version import line and the reference later on works around this. I've just upgraded my machine to RH8.0 and now (after recompiling scipy, chaco etc.) the wxdemo_plot.py runs but none of the plot labels or titles are displayed correctly, irrespective of which font I select (ttf or type1). This is the case for the latest chaco version (0.1.0-alpha-5.379) and also for a slightly earlier version of 0.1.0. Before upgrading to RH8.0, the earlier v0.1.0 seemed to work fine. Screenshot of demo attached. Note, the text in the chaco dialog boxes/button displays fine etc., as does text in my other wxPython applications. One final problem, I had scipy installed and runnnig OK prior to installing chaco. Installed chaco messes up the scipy fastumath module and now scipy fails on import with: ImportError: No module named fastumath. Re-installing SciPy fixes this. Besides RH8.0, I'm using python2.2.1, scipy-0.2.0-alpha-102.3553, Numeric-22.0 cheers, Bryan -- Bryan Cole Teraview Ltd., 302-304 Cambridge Science Park, Milton Road, Cambridge CB4 0WG, United Kingdom. tel: +44 (1223) 435380 / 435386 (direct-dial) fax: +44 (1223) 435382
I just installed the latest tar-ball from the website (0.1.0-alpha-5.379) and the setup.py fails with "import error: module chaco_version not found". Presumably there's a file missing from this distribution. Removing the chaco_version import line and the reference later on works around this.
Yes, we'll have to update the build process I suspect. Thanks for pointing it out.
I've just upgraded my machine to RH8.0 and now (after recompiling scipy, chaco etc.) the wxdemo_plot.py runs but none of the plot labels or titles are displayed correctly, irrespective of which font I select (ttf or type1). This is the case for the latest chaco version (0.1.0-alpha-5.379) and also for a slightly earlier version of 0.1.0. Before upgrading to RH8.0, the earlier v0.1.0 seemed to work fine. Screenshot of demo attached.
We have a machine running RH 8.0 here. I'll see if I can reproduce the problem.
One final problem, I had scipy installed and runnnig OK prior to installing chaco. Installed chaco messes up the scipy fastumath module and now scipy fails on import with: ImportError: No module named fastumath. Re-installing SciPy fixes this.
Besides RH8.0, I'm using python2.2.1, scipy-0.2.0-alpha-102.3553, Numeric-22.0
Hmmm...I'll have to look into that. It probably has something to do with the package structure. Dave Morrill
Hi,
- its image zooming is slow and memory demanding (once killed my linux box)
Those were making scipy/plt a little bit "impractical", so I did some modifications, which I attached to this email. I hope someone maintaining plt package will look at them and either incorporate or reimplement them.
Thanks. These sound like nice additions. I'll take a look.
I noticed the modification for image drawing didn't redraw properly with multiple windows. Attached is the new version.
Chaco already handles this and quite a bit of other stuff (including NaN support). It is extremely flexible also, allowing for arbitrary nesting of plot groups. Chaco will become the replacement for plt at some point (probably SciPy 0.3). In the mean time, we'll try to update plt with features like yours.
eric
I tried chaco, but in current states, it's too slow and unstable for daily use. I hope it will become fast and stable pretty soon :) Ken
participants (7)
-
bryan cole -
David C. Morrill -
Douglas Eck -
eric jones -
Francesc Alted -
Ken Sugino -
Prabhu Ramachandran