plotting with gnuplot.py

Grant Edwards grante at visi.com
Tue Sep 6 04:46:15 CEST 2005


On 2005-09-04, skorpio11 at gmail.com <skorpio11 at gmail.com> wrote:
> Still having some issues plotting:
>
> In attempting as explained above:
>
> import Gnuplot,Numeric
> filename = ('Default.PL1')
> data = scipy.io.array_import.read_array(filename)
>
> y = data[:,1]
> x = data[:,0]
> z = data[:,2]
>
> //I think u need to take the transpose of this column before
> plotting..
>
> x=Numeric.transpose(x)
> y=Numeric.transpose(y)
>
> g=Gnuplot.Gnuplot(debug=1)
> d=Gnuplot.Data(x,y)
> g('set logscale xy')
> g.plot(d)
>
> The file executes without generating any plot being displayed

The object "g" will be deleted when the scripts ends.  When
that happens, the gnuplot process is killed.  All this probably
happens before the plot window has been mapped to the display.

Add something like "sys.stdin.readline()" to the end of the
program so that it doesn't exit until you hit "Enter".

-- 
Grant Edwards                   grante             Yow!  Hmmm... a CRIPPLED
                                  at               ACCOUNTANT with a FALAFEL
                               visi.com            sandwich is HIT by a
                                                   TROLLEY-CAR...



More information about the Python-list mailing list