[Numpy-discussion] gnuplot problem with numpy
Brian Blais
bblais at bryant.edu
Fri Feb 10 08:40:04 CST 2006
Hello,
I have been trying to use the Gnuplot1.7.py module, but it doesn't seem to work with
numpy (although it works with Numeric). The following code plots two "identical"
sets of data, but the numpy data gets rounded to the nearest integer when passed to
Gnuplot. What is odd is that the offending code in utils.py, is the function
float_array(m), which does the conversion that I do in this script, but it doesn't
seem to work. Any ideas?
#----------------------------
import numpy
import Numeric
import Gnuplot
g = Gnuplot.Gnuplot(debug=1)
dh=.1;
x=numpy.arange(dh,2+dh,dh,'d')
y1 = x**2
y2=y1
d1 = Gnuplot.Data(x, y1,
title='numpy',
with='points') # doesn't work
d2 = Gnuplot.Data(Numeric.asarray(x,'f'), Numeric.asarray(y2,'f'),
title='Numeric',
with='points') # works
g.plot(d1,d2)
#----------------------------
thanks,
bb
--
-----------------
bblais at bryant.edu
http://web.bryant.edu/~bblais
More information about the Numpy-discussion
mailing list