[SciPy-user] Failed to plot array using gnuplot-py

Travis Oliphant oliphant at ee.byu.edu
Wed Feb 1 13:08:39 CST 2006


iCy-fLaME wrote:

>On 2/1/06, Robert Kern <robert.kern at gmail.com> wrote:
>  
>
>>iCy-fLaME wrote:
>>    
>>
>>>Not sure what is going on, dont even know if this is a glitch cause by
>>>gnuplot-py or scipy or python itself, but here is what i found out on
>>>my system.
>>>
>>>Fedora Core 4
>>>gnuplot-4.0.0-7
>>>gnuplot-py-1.7-1
>>>SciPy 0.4.4
>>>
>>>It wouldnt plot if i do this:
>>>=================================
>>>from scipy import linspace
>>>import Gnuplot
>>>g = Gnuplot.Gnuplot(debug = 1)
>>>x = linspace(0, 1, 20).astype('f')        # i.e. array(0.0, 0.05, 0.10, ... 1.0)
>>>y = linspace(0, 5, 20).astype('f')
>>>d = Gnuplot.Data(x, y)
>>>g.plot(d)
>>>=================================
>>>      
>>>
>>Did you see an error message, or did it just do nothing? What version of Numeric
>>do you have installed? I'm pretty sure the Gnuplot module still uses Numeric and
>>may not recognize numpy arrays. Hopefully, it will try to do something like
>>Numeric.asarray(x). If Numeric's version is >=24.0, that should automatically
>>convert the numpy array to a Numeric array efficiently.
>>
>>--
>>Robert Kern
>>robert.kern at gmail.com
>>
>>"In the fields of hell where the grass grows high
>> Are the graves of dreams allowed to die."
>>  -- Richard Harter
>>
>>_______________________________________________
>>SciPy-user mailing list
>>SciPy-user at scipy.net
>>http://www.scipy.net/mailman/listinfo/scipy-user
>>
>>    
>>
>
>
>It opened a x11 window, but nothing is plotted. Sometimes it complain
>about the range. I have a feeling it is converting all float to int,
>hence all zero and nothing to plot.
>
>It plots fine if i make x range >> than 1:
>=================================
>from scipy import linspace
>import Gnuplot
>g = Gnuplot.Gnuplot(debug = 1)
>x = linspace(0, 10, 20).astype('f')        # Make the end point >> 1
>y = linspace(0, 50, 20).astype('f')
>d = Gnuplot.Data(x, y)
>g.plot(d)
>=================================
>
>Ahh, my Numeric version is '23.7'
>  
>

Earlier versions of Numeric didn't handle it well if the return of the 
__array__ method (which I suspect it is calling), was not an actual 
Numeric ArrayObject.     On 32-bit platforms, the ndarray ArrayObject 
structure is the same as the Numeric ArrayObject structure.  However, 
the PyArray_Descr structure is quite a bit different and so I'm sure the 
type information is wrong if Numeric is just trying to use the output of 
the __array__ method on the ndarray object.  

Numeric should have been checking the output of the __array__ method and 
raising an error.  I know this got changed at some point, but I'm not 
sure how early.

-Travis




More information about the SciPy-user mailing list