Loading ...
Sorry, an error occurred while loading the content.
 

plotting data

Expand Messages
  • aditi gupta
    Hello Everybody, I m trying to plot data in data.txt using gnuplot. I m using ActiveState perl version 5.8.6 in a WindowsXP environment. I ve written
    Message 1 of 1 , Dec 30, 2005
      Hello Everybody,

      I'm trying to plot data in data.txt using gnuplot. I'm using ActiveState perl version 5.8.6 in a WindowsXP environment.

      I've written the following code:


      #!C:\perl\bin\perl -w

      #gnu1.pl
      #define location for gnuplot
      my $gnuplot = 'C:\perl\lib\gnuplot\wgnuplot';
      #give name for the output file
      my $output = 'plot.png';
      #data.txt is the file having data to be plotted
      #data is in single column with a data entry in each row
      my $file = 'data.txt';
      my $xaxis = "position";
      my $yaxis = "variability";

      open (GNUPLOT, "|$gnuplot") or die "can't open gnuplot:$!"; ## line 13

      print GNUPLOT << "gnuplot_commands";

      set term png
      set output "$output"
      set title "plot"
      set xlabel "$xaxis"
      set ylabel "$yaxis"
      plot "$file" using 1 title 'plot' with lines
      gnuplot_commands

      close (GNUPLOT);
      #to print the file to screen..
      $| = 1;
      #i don't know how to display the plot!!
      print "$output\n";

      -----------------------------------------------------------------------------
      When I run this code, I get the message "Can't open gnuplot: at gnu1.pl line 13" and a new gnuplot window is opened i.e. the data has not been passed to it.
      wgnuplot is the application file type in gnuplot folder.
      Please help me to figure out what is going wrong.. I also don't know how to display the plot on screen.

      Thanks in advance for your help.

      Wishing you a very Happy New Year.
      With best wishes,
      Aditi


      Send instant messages to your online friends http://in.messenger.yahoo.com

      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.