plotting with gnuplot.py

S

skorpio11

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...
 
V

Varun Hiremath

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
 
S

skorpio11

Thanks for the response Varun,

I guess I still not sure the distingtion betweein gnuplot.py and its
implentation in scipy.
 
S

skorpio11

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 however
the debug option generates this output:

gnuplot> set terminal windows
..
..
gnuplot> plot 'c:\documen~1\leon\loca`l\temp\tmpuskt1' notitle

When I open this file in wordpad it contains the contents of the d
array.

Any ideas why gnuplot is not outputing to the screen??
 
G

Grant Edwards

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".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top