Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Generating Gnuplot graphs from Perl - and keeping them open

Reply
Thread Tools

Generating Gnuplot graphs from Perl - and keeping them open

 
 
ryan
Guest
Posts: n/a
 
      05-30-2007
I have a Perl program that successfully executes commands in Gnuplot
(importing a file and plotting) but I have one problem. I cannot
figure out how to keep the graph alive. The program executes, flashes
the graph I need and closes everything. The Gnuplot code is here:

open(GNU,">$name.p");

print GNU "set style data lines\n";
print GNU "set autoscale\n";
print GNU "unset log\n";
print GNU "unset label\n";
print GNU "set xtic auto\n";
print GNU "set ytic auto\n";
print GNU "set title \"Random Walk\"\n";
print GNU "set xlabel \"Iteration\"\n";
print GNU "set ylabel \"Position\"\n";
print GNU "plot";
print GNU " \"$name.dat\" using 1:2 title \'Random Walk\' with
linespoints $count\n";
print GNU "replot $mean title \'mean\'\n";

close DAT;

#---------------------------------------------------------------
#--------------------------------------------------------------
# Attempt to produce graph
# This part calls gnuplot and executes the commands

open(GNUPLOT, "|$GNUPlot");


# The next line means that the following lines should
# be outputted to the gnuplot program until
# the words "gnuplot_Commands" is found

print GNUPLOT << "gnuplot_Commands";
load '$name.p'
gnuplot_Commands

close(GNUPLOT);

How do I change the code so Gnuplot stays open and the graph is
displayed for the user?

Thanks,

 
Reply With Quote
 
 
 
 
Mumia W.
Guest
Posts: n/a
 
      05-30-2007
On 05/30/2007 10:13 AM, ryan wrote:
> [...]
> close(GNUPLOT);
>
> How do I change the code so Gnuplot stays open and the graph is
> displayed for the user?
>


Use the -persist option to gnuplot.

> Thanks,
>


You're quite welcome.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Profiling and generating call graphs Andrea Crotti C Programming 1 07-31-2010 01:34 PM
Plotting Graphs using Gnuplot arslanburney@gmail.com Python 3 06-13-2008 07:51 AM
[Urgent] Generating dynamic graphs @ runtime? viki.sanjeeva@gmail.com Java 4 03-10-2006 11:23 AM
generating time series graphs with perl Po Boy Perl Misc 12 05-02-2004 11:56 PM
generating graphs from table Ike HTML 3 12-17-2003 07:27 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57