Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Perl Programming Language

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,

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.
In article <qki7i.14951$Ut6.3@newsread1.news.pas.earthlink.net>,

Mumia W. <paduille.4061.mumia.w+nos@earthlink.net> wrote:
> 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.

Also, you can put a Gnuplot "PAUSE" command in the plot command file,
and/or pause your Perl program by reading input from the keyboard until
you hit RETURN:

    my $input = <STDIN>;

--
Jim Gibson

 Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
    ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------        
                http://www.usenet.com

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc