moving wxPyPlot

I still need a scrolling plot canvas, too. I was looking at adapting
wxPyPlot but there are too many changes that would be needed, so I'm
starting to think about a new control and maybe it could be integrated with wxPyPlot later.

It would be like a seismograph or heart beat monitor. The scrolling plot should be "live" - keep scrolling even when no new data is being scrollbar to scroll back and see earlier data.

It should subclass wxScrolledWindow AND wxTimer, or else use an internal thread to update the plot similar to wxpython/lib/throbber.py. It should be able to plot multiple lines (models) in one plot.
There would be settings like the time scale to use (scroll in real-time or faster or slower), the data cache (store last X seconds or X data points), the frame rate to shoot for (view updates per second), what to do when there is no new data (go to zero like a seismograph or stay at current position), etc.

So I'm working on this, but anyone else feel free to suggest anything else or take a crack at it yourself.

For the demo, I'm using three simple "models" that run in their own threads and send data to the plot: sin(time), and the current mouse X & Y positions on the screen (wxGetMousePosition).

-Doug

···

sent from separate threads or processes. You should be able to use a

i use the latest release of python/wxpython on w2k
i ve made a wxListCtrl, in wx_virtual mode, and wx_icon !

i know i can change the horizontal/vertical space between icon, in windows desktop pannel
but i'm pretty sure i cant do it in wx ... and got specials space only for my wxlistctrl ...

i'd like to have 30px horizontal/vertical space in w2k
and i'd like to have 5px horizontal/vertical space in my wxlistctrl

i'm pretty sure that is possible ... but i can't found an api to set this (ther is a wx api to get this)

can you help me ?

Doug,

I still need a scrolling plot canvas, too.

Are you looking for a "Chart Recorder" ? I would myself be interested in this kind of control, together with an oscilloscope. I am working on an oscilloscope now, but may neeed a Char Recorder, too, with a play-back feature. Once I have something which works I will put it on the lsit.
peter

I too am looking for something similar to a chart recorder. However I have data which is tagged with it's reception time which I want to plot within a certain time window, so having the plot scroll itself would be useful. I'm using wxPyPlot at the moment in my prototype but I haven't addressed the time scale as of yet on my trend displays.

Who says you can't write a satellite telemetry processing system in Python.

···

On Friday, Oct 3, 2003, at 09:57 Europe/Berlin, Peter Wurmsdobler wrote:

Doug,

I still need a scrolling plot canvas, too.

Are you looking for a "Chart Recorder" ? I would myself be interested in this kind of control, together with an oscilloscope. I am working on an oscilloscope now, but may neeed a Char Recorder, too, with a play-back feature. Once I have something which works I will put it on the lsit.
peter

it's an old mail (cache:HMrhvthhJ64J:lists.wxwindows.org/archive/wx-users/msg26095.html wxlistctrl setitemspacing - Recherche Google)

but it seems this api, in wxListCtrl ; "SetItemSpacing()" is dead no ?
is there another way ?

3rs wrote:

···

i use the latest release of python/wxpython on w2k
i ve made a wxListCtrl, in wx_virtual mode, and wx_icon !

i know i can change the horizontal/vertical space between icon, in windows desktop pannel
but i'm pretty sure i cant do it in wx ... and got specials space only for my wxlistctrl ...

i'd like to have 30px horizontal/vertical space in w2k
and i'd like to have 5px horizontal/vertical space in my wxlistctrl

i'm pretty sure that is possible ... but i can't found an api to set this (ther is a wx api to get this)

can you help me ?

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

using wxpyton 2.4.2.4 and the last python, on w2k

sometimes (not always) , wxProgressDialog blocks my application !?
the dialog stands in front of the application ... the progress seems blocked
and i have no other way to kill the application ...

Doug Holton wrote:

I still need a scrolling plot canvas, too. I was looking at adapting
wxPyPlot but there are too many changes that would be needed, so I'm
starting to think about a new control and maybe it could be integrated
with wxPyPlot later.

I'm not sure I'd start from scratch..there's some good stuff in
wxPyPlot. However, whether you cut& paste code from wxPyPlot into yours,
or alter wxPyPlot doesn't make much difference.

It would be like a seismograph or heart beat monitor. The scrolling
plot should be "live" - keep scrolling even when no new data is being
sent from separate threads or processes. You should be able to use a
scrollbar to scroll back and see earlier data.

It should subclass wxScrolledWindow AND wxTimer, or else use an internal
thread to update the plot similar to wxpython/lib/throbber.py.

Use wxTimer. There's no reason to use threads for this kind of thing.
Throbber.py should probably use a wxTimer as well, but it was written
that way first, and serves as a good demo for how to post events from
threads to update your GUI. Where you should use threads is to run a
computation or something asyncronously, and then post events form that
thread to update the GUI.

This brings up my suggestion for how to structure your scrolling
canvas...

Rather than have the updateing of the plot built in, you should build a
plotwindow that has some sort of update method. For your use, you would
either subclass this and an an auto-update, or just use it as a member
of your new class that does the auto updateing. In fact, the way I've
re-written wxPyPlot could alrady support most of this (though it can use
some cleaning up).

I'm also not sure I'd use wxScrolledWindow. If you do that, you'll get a
lot of re-painting as you scroll. If it's something that Paints fast,
that's just fine, but if not, it can get ugly. What I'd like to see is a
way to indicate what part of your time series you want to see, and then
call your update method and re-draw the image. This is why I didn't use
wxSCrolledWindow in my Float Canvas. Rather, you can drag the image
where you want it, and it only re-draws when you are done dragging.

My version of wxPyPlot supports most of what you need. Update the data,
and them call the Zoom method. The one real problem I see is that the
way I have it structured now, you can re-draw the data fast, if the axis
havn't changed. For your purposes, however, you'll need to re-draw at
least the X-axis (time) as you scroll. When we tried updating the plot
by re-calculating and re-drawing the entire axis each time, it was way
too slow.

What I'd be inclined to do is break the wxPyPlot Draw() method into
components:

draw X axis
draw X axis labels
draw Y axis
draw Y axis labels
draw grid
draw legend
draw data

I've re-worked wxPyPlot a little more, so that it used an extra buffer
for the Axis. NOw, when you re-draw the data, it blits the axes buffer
tot he main buffer, then draws the data on top of it. THis way you can
have grid lines, etc. It seems to work well, except for two things:

1) I had to add and extra wxClientDC.DrawBitmap call in the Draw()
method, or the whole image didn't display in the demo. If you covered
and uncovered the window, it does display, so the off screen bitmap is
correct. Wierd. (Linux, python2.3 wxPythonGTK 2.2.4.2 ) Does anyone else
get this behaviour?

2) Printing has probably been screwed up. I havn't tested that yet.

You might want to make the legend a separate bitmap as well, then you
could draw it once, and always put it back on top of the plot after

For the demo, I'm using three simple "models" that run in their own
threads and send data to the plot: sin(time), and the current mouse X &
Y positions on the screen (wxGetMousePosition).

How far have you gotten with your demo? Do you have something to post?

I've enclosed my latest wxPyPlot.

-Chris

wxPyPlot2.py (55.7 KB)

···

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Doug Holton wrote:

I still need a scrolling plot canvas, too. I was looking at adapting
wxPyPlot but there are too many changes that would be needed, so I'm
starting to think about a new control and maybe it could be integrated with wxPyPlot later.

It would be like a seismograph or heart beat monitor. The scrolling plot should be "live" - keep scrolling even when no new data is being sent from separate threads or processes. You should be able to use a scrollbar to scroll back and see earlier data.

Somebody (sorry I don't remember who) presented some wxPython graph plotting classes at a Lightning Talk at OSCON. I don't remember if they handled live updates but they did a *very* good job with scrolling, scaling, etc. with no flicker.

If anybody knows who that was it would probably be wise to bring him in on this conversation and colaborate.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

3rs wrote:

i use the latest release of python/wxpython on w2k
i ve made a wxListCtrl, in wx_virtual mode, and wx_icon !

i know i can change the horizontal/vertical space between icon, in windows desktop pannel
but i'm pretty sure i cant do it in wx ... and got specials space only for my wxlistctrl ...

i'd like to have 30px horizontal/vertical space in w2k
and i'd like to have 5px horizontal/vertical space in my wxlistctrl

i'm pretty sure that is possible ... but i can't found an api to set this (ther is a wx api to get this)

There is SetItemSpacing, but it is not available on MSW for some reason...

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

3rs wrote:

using wxpyton 2.4.2.4 and the last python, on w2k

sometimes (not always) , wxProgressDialog blocks my application !?
the dialog stands in front of the application ... the progress seems blocked
and i have no other way to kill the application ...

If you can find a way to reproduce the problem reliably please provide a small sample.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Chris Barker wrote:

Use wxTimer. There's no reason to use threads for this kind of thing.
Throbber.py should probably use a wxTimer as well, but it was written
that way first,

And has been rewritten for 2.4.2.4 to use timers.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Hello,
The PyPlot2 works great under Linux. Under Windows, however, the old lines in the plot are not erased. So after a while the plotcanvase gets quite filled. Any idea?
peter