473,804 Members | 3,958 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_arr ay(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
4 4551
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_arr ay(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_arr ay(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.trans pose(x)
y=Numeric.trans pose(y)

g=Gnuplot.Gnupl ot()
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_arr ay(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.trans pose(x)
y=Numeric.trans pose(y)

g=Gnuplot.Gnupl ot(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\l eon\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*******@gmai l.com> wrote:
Still having some issues plotting:

In attempting as explained above:

import Gnuplot,Numeric
filename = ('Default.PL1')
data = scipy.io.array_ import.read_arr ay(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.trans pose(x)
y=Numeric.trans pose(y)

g=Gnuplot.Gnupl ot(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.read line()" 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
4459
by: Gerrit Holl | last post by:
Hi, I have a dictionairy containing DateTime objects as keys and integers as values. What would be the easiest way to create a simple plot of these, with a number axis versus a time axis? What library is the most suitable for this? 'plot' on parnassus yields 18 hits, but since I have zero experience, I don't know where to start. What makes it difficult is that I have a time axis instead of a simple integer x-axis. Gnuplot doesn't seem...
6
2665
by: Richard | last post by:
I am going to need to plot some data and formula results from Python. A few years ago I used gnuplot (not from Python) and was wondering which Python plotting module I should use (learn)? I have seen DISLIN mentioned on "onlamp.com" and see that gnuplot has a python module wrapper. Any suggestions on Python plotting modules? (DISLIN or gnuplot.py or ????) Thanks
9
4716
by: syd | last post by:
I don't even know where to begin. This is just bizarre. I just picked up the Gnuplot.py module (a light interface to gnuplot commands) and was messing around with it today. I've got a tiny script, but it only works from the command line about half the time! In the python interpreter, 100%. Ipython, 100%. I'm not kidding. #!/bin/env python import Gnuplot
1
3370
by: Nicola Kaiser | last post by:
Hi, I´m using Gnuplot via gnuplot.py and I´m looking for a way to get the plotting output (terminal set to png in my case) piped in a string instead of to stdout or a file. Is there any method in gnuplot.py that does this for me? If not, I tried something like:
8
1715
by: Freddy | last post by:
Hi guys, I have a quick question, I have a program that generates numerical output (as most of the programs), the program is written in C language, and currently I use the "DOS interface to show the output when it is being generated. is there a "short" and "non-complicated" code which plots the data automatically instead of showing the numbers.
7
6854
by: diffuser78 | last post by:
My python program spits lot of data. I take that data and plot graphs using OfficeOrg spredsheet. I want to automate this task as this takes so much of time. I have some questions. 1. Which is the best graph plotting utility in python or linux. Can I write a code in such a way that my python code automatically gives me a graph. I know little about gnuplot. If you know any better tool without much learning curve please tell me in Linux. ...
3
6200
by: arslanburney | last post by:
Hello. Was trying to create a simple plotting function. Wasnt working however. If i write the same code without putting it inside a function it works. :S. Could some1 tell me the problem? Heres the code: # File name Plotting2 import Gnuplot def plot(original, expected, actual):
7
3559
by: arslanburney | last post by:
Hello. Ive got two functions here. Somehow the program does not go in to the second function wehn i call it. The bestfit function. Could some1 help me identify the problem. Heres the code: import Gnuplot def bestfit(uinput): if not isinstance(uinput, list):
7
2949
by: zdravko.monov | last post by:
Hi there! I need a C++ library that can organize and write scientific (and numerical overall) data in tables. I have been fighting with std::ofstream and plain ASCII files, but it is difficult to position columns by an offset, impossible to draw table borders etc. I am currently thinking of a class that is able to write to an html file, e.g. As far as I know, html offers much better text (and table) layout. And the format is portable!...
0
9707
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10586
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10323
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6856
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5658
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.