[prev in list] [next in list] [prev in thread] [next in thread]
List: flightgear-cvs
Subject: [Flightgear-cvslogs] CVS: source/scripts/perl/examples logging.pl,
From: "Curtis L. Olson" <curt () flightgear ! org>
Date: 2004-02-27 23:28:26
Message-ID: E1AwrP8-0004Hs-00 () baron ! me ! umn ! edu
[Download RAW message or body]
Update of /var/cvs/FlightGear-0.9/source/scripts/perl/examples
In directory baron:/tmp/cvs-serv16467/perl/examples
Modified Files:
logging.pl
Log Message:
Add a function to do plots with any channel being X and any other channel
being "Y".
Index: logging.pl
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/scripts/perl/examples/logging.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** a/logging.pl 17 Feb 2004 23:03:31 -0000 1.3
--- b/logging.pl 27 Feb 2004 23:28:23 -0000 1.4
***************
*** 135,139 ****
! sub quick_plot {
my( $data_file ) = shift;
my( $plot_file ) = shift;
--- 135,139 ----
! sub quick_plot_vs_time {
my( $data_file ) = shift;
my( $plot_file ) = shift;
***************
*** 170,172 ****
--- 170,209 ----
+ sub quick_plot {
+ my( $data_file ) = shift;
+ my( $plot_file ) = shift;
+ my( $xtitle ) = shift;
+ my( $ytitle ) = shift;
+ my( $xcolumn ) = shift;
+ my( $ycolumn ) = shift;
+
+ print "quick plot -> $plot_file\n";
+
+ my( $tmpcmd ) = "$tmp_dir/plot_cmd_tmp.$$";
+ my( $tmpdata ) = "$tmp_dir/plot_data_tmp.$$";
+ my( $png_image ) = "$plot_file.png";
+
+ # strip the leading header off the file so gnuplot doesn't squawk
+ system( "tail +2 $data_file | sed -e \"s/,/ /g\" > $tmpdata" );
+
+ # create the gnuplot command file
+ open( CMD, ">$tmpcmd" );
+ print CMD "set terminal png color\n";
+ print "png_image = $png_image\n";
+ print CMD "set output \"$png_image\"\n";
+ print CMD "set xlabel \"$xtitle\"\n";
+ print CMD "set ylabel \"$ytitle\"\n";
+ print CMD "plot \"$tmpdata\" using $xcolumn:$ycolumn title \"$xtitle vs. $ytitle\" with lines\n";
+ print CMD "quit\n";
+ close( CMD );
+
+ # plot the graph
+ system( "gnuplot $tmpcmd" );
+
+ # clean up all our droppings
+ unlink( $tmpcmd );
+ unlink( $tmpdata );
+ }
+
+
return 1; # make perl happy
_______________________________________________
Flightgear-cvslogs mailing list
Flightgear-cvslogs@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-cvslogs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic