ATTENTION: There is a new version of ppgplot available at:
http://efault.net/npat/hacks/ppgplot/
Download the latest version from the website mentioned above, i.e.:
http://efault.net/npat/hacks/ppgplot/dist/ppgplot-1.3.tar.gz
After downloading execute the following commands:
Problems:
ppgplot can be compiled either with numarray or Numeric support, but not both!
The system this problem occured was a SuSE 7.3 on a notebook,
python 2.3.3 (also tried 2.2.1) with Numeric 23.1
(21.3) and numarray 0.8.
In essence, whenever trying to plot a Numeric array, the following error occured: ''ppgplot.typeerror: cannot cast vector to floats'' (in the 1.1 version)
Also trying to to run one of the examples with version 1.3 resulted into an error:
File ''ex_graph.py'', line 24, in ? ppgplot.pgpt(xs,ys,9) _ppgplot.typeerror: object is not an array
It is the Numeric arrays that cause the problem, the numarray ones are ok, the standard example na_ex_graph.py plots fine.
The tested example was:
X = [1.,2.,3.,4.,5.,6.,7.,8.,9.,10.]
dataX = Numeric.reshape(X,(Numeric.shape(X)))
dataX array([ 1., 2., 3., 4., 5., 6., 7., 8.,
9., 10.])
ppgplot.pgbox('BCTSN',0.0,0,'BCTSNV',0.0,0)
ppgplot.pgline(dataX,dataX)
Traceback (most recent call last):
File ''stdin
'', line 1, in ?
_ppgplot.typeerror: object is not an array
In the earlier version of ppgplot the message was ''ppgplot.typeerror: cannot cast vector to floats''.
Commenting out the numarray support in setup.py does not change
the error.
A typical error message when trying to plot can look like the following example:
Traceback (most recent call last): File "<stdin>", line 1, in ? File "/home/smueller/bin/BoA/BoaFocus.py", line 127, in scanFocus self.BoaB.Graphic.Focus.scanFocus() File "/home/smueller/bin/BoA/BogliFocus.py", line 65, in scanFocus self.plotDataXY(dataX,dataY,'p',k) File "/home/smueller/bin/BoA/BogliPlot.py", line 337, in plotDataXY ppgplot.pgpt(dataX,dataY,self.symbolPoint) # plot points _ppgplot.typeerror: object is not an array
Solution:
The problem was, that ''ppgplot'' was compiled with numarray support, and then it was tried to use it with Numeric. This does not work! That is: the ppgplot built for numarray, and the ppgplot built for Numeric are *not*, so to say, compatible. You have to select which python extension you will support (numarray, or Numeric) when you *build* ppgplot. You can't have both at the same time.
So, in order to make the example above work, try this:
1. Clean up everything in the source distribution (e.g. do a ''make clean'', or remove the distribution, and unpack it from scratch)
2. Edit ''setup.py''. Comment-OUT the line:
from numarray.numarrayext import NumarrayExtension
AND ALSO comment-IN the line (a few lines below):
raise ImportError
3. Rebuild and install everything as described in INSTALL.
The resulting version of ppgplot will be able to work with Numeric arrays, but *not* with numarray arrays.
Instead of point 3 above, you can try saying ''make'' which will build and install everything *in-place*. Then you can run python, *without changing the current directory*, and try the example above. This will help you determine if there is some other incompatible ppgplot version somewhere in you path.
When you build ''ppgplot'', please pay attention to the output. You should see a line identifying which ppgplot version (the numarray or the Numeric) you are building:
using Numeric...
or
using numarray...