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:
p=Gnuplot.Gnupl ot(debug=1)
p('set terminal png')
oldstdout=sys.s tdout
output=cStringI O.StringIO()
sys.stdout=outp ut
p.plot([[1,0],[2,50],[3,0],[4,20],[5,0],[6,30],[7,70], [8,70], [9, 75],
[10, 50], [11, 30], [12, 50]])
sys.stdout=olds tdout
print output.getvalue ()
But unfortunately I also get other stuff like:
"gnuplot: unable to open display ''
"gnuplot: X11 aborted"
in the same string
Can anyone help me on this?
Thanks,
Nicola 1 3356
On 2005-08-18, Nicola Kaiser <Ni***********@ urz.uni-heidelberg.de> wrote: 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.
Plotting to a file and then reading the file is pretty trivial:
import Gnuplot,time
filename = 'foo.png'
p = Gnuplot.Gnuplot ()
p('set term png')
p('set out "%s"' % filename)
p.plot('sin(x)' )
p('set out')
time.sleep(0.1) # wait for gnuplot to process all the commands
s = open(filename,' rb').read()
Since gnuplot is running asycnronously and reading commands
from a pipe, you've got to give it some time to finish
executing the commands before you attempt to read the file.
Is there any method in gnuplot.py that does this for me?
I don't think so.
If not, I tried something like:
p=Gnuplot.Gnupl ot(debug=1) p('set terminal png') oldstdout=sys.s tdout output=cStringI O.StringIO() sys.stdout=outp ut p.plot([[1,0],[2,50],[3,0],[4,20],[5,0],[6,30],[7,70], [8,70], [9, 75], [10, 50], [11, 30], [12, 50]]) sys.stdout=olds tdout print output.getvalue ()
That's not going to work.
The gnuplot engine isn't a Python program. It's not writing to
sys.stdout, it's writing to Unix file descriptor 1. In order
to do things the way you're attempting to, you'd have to
redirect file descriptor 1 to a pipe before you start the
gnuplot engine, then read the plot data from the pipe.
The Gnuplot module may already be redirecting the gnuplot
processes output file descriptors, so attempting to do it
yourself might not work anyway.
But unfortunately I also get other stuff like:
"gnuplot: unable to open display '' "gnuplot: X11 aborted"
in the same string
Can anyone help me on this?
You shouldn't have gotten messages about the X11 terminal
driver if you really had set the terminal type to png.
--
Grant Edwards grante Yow! Are you selling NYLON
at OIL WELLS?? If so, we can
visi.com use TWO DOZEN!! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: ¶}¾Ç¤F¶Ü? |
last post by:
I'm trying to write a script to pass a file of stock prices and volumes,
and plot the results on a gnuplot graph which is non-overlapped graph.
Fig. 1
------------
Fig. 2
Figure 1 is a graph of stock prices, and Figure 2 is a graph of stock volumes,
I'm trying to implement it as following codes,
|
by: Rama Calaga |
last post by:
Hi, I use both python and gnuplot a lot, but I am
unable to find a way to embed gnuplot "window/canvas" into tkinter. BLT option in
PMW is not so powerful and not so great, any suggestions ??
thanks
ram
|
by: Alythh |
last post by:
I just installed Chart::Graph::Gnuplot, and I'm fairly satisfied.
But...
My wish is to be able to make a gnuplot() call, make it display the
graph, and stay there while other data becomes available... while
replotting the updated data.
Is there a way to communicate between the two processes in this way?
Or is this module just to output to a file?
|
by: Joseph Suprenant |
last post by:
Hello all,
I have a C++ program, it does some calculations on things and then
prints out a file in the format in which GNUPLOT can use. So my question is
how would i call GNUPLOT from my C++ program. I know in some operating
systems you can do system("gnuplot"); But not with red hat 7.3. So could
some kind soul help me out? After it starts up GNUPLOT my program will
terminate.
Thanks
|
by: Sanyi Benczik |
last post by:
Is there a standard way in C++ to call an external program or is this
platform dependent?
If it is platform dependent, can somebody drop a line what to use or
where to look for info for GNU C++ on RedHat? I am doing some numerical
calculations and need to invoke an external plotting program (gnuplot)
and return to the numerics.
Sorry if I posted twice.
| |
by: Alexander Stippler |
last post by:
Hello,
I want to visualize numerical results with gnuplot. The easiest way would be
to
use a pipe to gnuplot. But I want to be platform independent, just relying
on
the C++-standard. What is the recommended way of getting this functionality?
regards,
alex
|
by: Bernhard Hidding |
last post by:
Hello,
my c++ programm produces a variable number of ASCII files with variable file
names. These are to be plotted in with gnuplot. I use
system("gnuplot -persist my_gnuplot_script.gpl");
to open gnuplot, and "my_gnuplot_script.gpl" contains a list of files to be
plotted (e.g. plot "array13.dat", "array87.dat",...). However, each time the
program runs, different files are to be plotted, so I have to change the
file names in my gnuplot...
|
by: Anton81 |
last post by:
Hi,
it seems to be a FAQ, but I still haven't found a solution. I want to
control gnuplot with a python program. The following at least gives me the
gnuplot output:
subp=Popen("gnuplot",stdin=None,stderr=PIPE,stdout=PIPE)
....
subp.stderr.readline()
|
by: Peter Beattie |
last post by:
I am trying to plot something in gnuplot 4.2 using co-ordinates a Python
2.5 program computes. Here's what I'm doing:
pyfrom subprocess import *
pyplot = Popen("c:/progs/gp/bin/wgnuplot.exe", stdin=PIPE)
pyplot.stdin.write("plot x*x")
The first command dutifully opens gnuplot, but the second doesn't do
anything. Could someone favour me with an explanation as to the whyness?
|
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):
|
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...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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...
|
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...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
| |
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |