|
From: Michael H. <mh...@al...> - 2013-12-09 07:47:18
|
On 12/08/2013 02:49 PM, Richard Langley wrote:
> I have a file of x,y real data pairs with the values to 9 digits of
> precision. When I use gnuplot to plot the data directly using, say:
> plot 'HHAT3260.csv' using 2:1
> I get a detailed plot with the values at their original precision.
> However, when I use gnuplot within Python (having read in the file to
> float lists x and y) using:
> g = Gnuplot.Gnuplot(debug=1)
> d = Gnuplot.Data(x, y, with_='points')
> g.plot(d)
> I get a plot with plotted values rounded or truncated to 7 digits of
> precision, it seems. Is there a way to preserve the precision of the
> data when using py-gnuplot?
Gnuplot.py's default is to treat data as 32-bit floating point numbers.
But if you explicitly pass double-precision data to Gnuplot.Data(),
then I think it will pass the data to gnuplot with the higher precision.
I.e., do something like
d = Gnuplot.Data(
numpy.array(x, dtype=numpy.float64),
numpy.array(y, dtype=numpy.float64),
with_='points',
)
Michael
--
Michael Haggerty
mh...@al...
http://softwareswirl.blogspot.com/
|