I’m writing an application to view binary “waveform” data files and I’ve found that wx.lib.plot can do just about everything needed. (That’s good
because it is relatively small and it’s part of the wxPython distribution.)
On
Linux, CentOS5, I’ve used both python 2.4 and 2.6 with installs of wxPython 2.8.12.0 and 2.9.2.4 and have run into a problem when zooming in a few times on a plot. This appears to be the same problem once reported and closed (due to being “outdated”… even though it apparently exists still) here: http://trac.wxwidgets.org/ticket/1583
This
problem is present even in the wxPython demo for PyPlot on this platform. The problem is not present in Windows (as in that bug report and in my Python 2.5 and wxPython 2.8.9.1).
To reproduce:
Start the wxPython demo (demo.py)
Select PyPlot from the More Windows/Controls section of the tree.
Start the plot demo (click the Show the PyPlot sample button)
Select Plot->Draw 4 and Plot->Enable Zoom
Zoom in about 6 times until you’re down around one marker, one more time and the plot area fills with lines.
In
my application, this occurs with fewer zooms, on even small data sets. It appears the extra lines are from data that should be outside the current plot region - it looks like it’s wrapping or folding back into the plot region. I can get this to occur on plot 7, as well (though not as easy). I can post a short example with small data set if needed.
Has
anyone dealt with this, have a workaround suggestion or should I submit
a bug report? I don’t know how to determine at what level this problem is coming from (e.g. in the gtk library or up in the application?).
i need wxpython module manual free if possible can you please tell me where to find it also if there is outsourcing site with reasonable price for me i appreciate to give me the link for it
thanks in advance
Hi - OP here. I’m new to the group and still looking for some help.
Given the problem with zooming in the wx.lib.plot module in RHEL / CentOS 5 with not-too-old versions of Python and wxPython, I’m looking for some suggestions or comments:
If this is a GTK or wxWidgets issue - how could I determine that?
Should I …
try another version of a gtk lib, etc. ?
post this elsewhere, e.g. wxWidgets forum or bug list?
forget this approach and try another toolkit or plot utility?
work around the problem, e.g. by modifying wx.lib.plot to clip the data array before drawing it on the canvas?
The big dog for graphing in Python is matplotlib, which works inside wxPython. Unfortunately, I have little to no experience with it or with PyPlot, but it is another option for you. You might be able to use FloatCanvas to draw your graph too, but I’m not sure. What I am sure about is that if you can spare a few hours, Robin or Chris will jump in here and give us both a clue.
Thanks, Mike. Yes, I have some apps with Matplotlib and have even made a wrapper class for a matplotlib panel to make it easy to include in other apps… But it’s quite a bit of overkill for this application. wx.lib.plot (was pyplot quite a while back) fits the bill… but I need zoom to work and thought there might be a workaround.
Unfortunately I have no idea what could be going wrong here, or even what to guess other than perhaps when deeply zooming that the logical size of the DC is overflowing some internal integral value and causing gtk to freak out. However when that is the problem we usually see issues on Windows, not GTK.
If you want to dig into the plot module and narrow down at what zoom level the problem manifests itself, and what the other parameters affecting the drawing are, then maybe that will help determine the cause of the problem (like something is over- or under-flowing, the numpy array is getting mangled, etc.) If you're able to do that then perhaps a good workaround would be to limit the zoom to just before it gets to the point of screwing up.
···
On 10/28/11 12:27 PM, ScottH wrote:
Hi - OP here. I'm new to the group and still looking for some help.
Given the problem with zooming in the wx.lib.plot module in RHEL /
CentOS 5 with not-too-old versions of Python and wxPython, I'm looking
for some suggestions or comments:
- If this is a GTK or wxWidgets issue - how could I determine that?
Should I ...
- try another version of a gtk lib, etc. ?
- post this elsewhere, e.g. wxWidgets forum or bug list?
- forget this approach and try another toolkit or plot utility?
- work around the problem, e.g. by modifying wx.lib.plot to clip the
data array before drawing it on the canvas?
Yes, I’m going to try to see what else might be going on in more detail. I found the FloatCanvas has the same trouble, by the way.
I’m not that familiar with how the canvases work under the hood, e.g. when data is outside a visible region, etc. Is there a good reference or explanation for this somewhere (e.g. what determines the visible portion of a canvas, or is the canvas a large virtual area that we can view a portion of in a panel, etc.) ?