Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   Generating Gnuplot graphs from Perl - and keeping them open (http://www.velocityreviews.com/forums/t903276-generating-gnuplot-graphs-from-perl-and-keeping-them-open.html)

ryan 05-30-2007 03:13 PM

Generating Gnuplot graphs from Perl - and keeping them open
 
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,


Mumia W. 05-30-2007 05:17 PM

Re: Generating Gnuplot graphs from Perl - and keeping them open
 
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.


All times are GMT. The time now is 04:14 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.