467,925 Members | 1,811 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,925 developers. It's quick & easy.

plotting with gnuplot.py

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

Sep 2 '05 #1
  • viewed: 4303
Share:
4 Replies
On Fri, Sep 02, 2005 at 02:35:45AM -0700, sk*******@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
-----------------------------------------------
Sep 2 '05 #2
Thanks for the response Varun,

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

Sep 3 '05 #3
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??

Sep 4 '05 #4
On 2005-09-04, sk*******@gmail.com <sk*******@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...
Sep 6 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Gerrit Holl | last post: by
6 posts views Thread by Richard | last post: by
1 post views Thread by Nicola Kaiser | last post: by
8 posts views Thread by Freddy | last post: by
7 posts views Thread by diffuser78 | last post: by
3 posts views Thread by arslanburney | last post: by
7 posts views Thread by arslanburney | last post: by
7 posts views Thread by zdravko.monov | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.