R
ryan
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,
(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,