plotting with gnuplot.py

Varun Hiremath varunhiremath at iitm.ac.in
Fri Sep 2 12:02:09 CEST 2005


On Fri, Sep 02, 2005 at 02:35:45AM -0700, skorpio11 at gmail.com wrote:
> Hi,
> 
> I've been having some problems trying some basic plotting commands with
> gnuplot.py. My setup is the Python 2.3 Enthought edition and my script
> looks as:
> 
> from scipy import *
> from scipy import gplt
> import scipy.io.array_import
> #import Gnuplot
> 
> filename = ('Default.PL1')
> data = scipy.io.array_import.read_array(filename)
> 
> 
> y = data[:,1]
> x = data[:,0]
> z = data[:,2]
> gplt.plot(x,y,'with points')
> gplt('set logscale x')
> gplt('set logscale y')
> 
> 
> With the following error message:
> 
> --->gplt('set logscale x')
> TypeError: 'module' object is not callable
> warning: Failure executing file: <data.py>
> 
> Any help would appreciated...


Hi,

Try doing this:

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()
d=Gnuplot.Data(x,y)
g('set logscale xy')
g.plot(d)

It should work...

Bye

-- 
-----------------------------------------------
Varun Hiremath
461, Jamuna Hostel
IIT Madras,
Chennai - 600 036
mob : +919840299732
-----------------------------------------------
My Webpage : http://www.ae.iitm.ac.in/~ae03b032
-----------------------------------------------



More information about the Python-list mailing list