By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,898 Members | 1,245 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,898 IT Pros & Developers. It's quick & easy.

plotting with gnuplot.py

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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.