#!/usr/bin/perl
#
# create some graphs, generating Postscript and then converting to GIF
#
# MWR 3/16/2006



# straightforward graph of several passbands on a single graph
$cmdfile = "stara_airmass.gnu";
$psfile = "stara_airmass.ps";
open(CMDFILE, ">$cmdfile") || die("can't open $cmdfile");
printf CMDFILE "set output '$psfile' \n";
printf CMDFILE "set term postscript enhanced color \"10x20\" 14 \n";
printf CMDFILE "set grid \n";
printf CMDFILE "set nokey  \n";
printf CMDFILE "set xlabel 'Airmass' \n";
printf CMDFILE "set ylabel 'Instrumental magnitude'  \n";
printf CMDFILE "set title 'Brightness of a star over many hours, UT Jul 27 2001'  \n";
printf CMDFILE "plot [0.9:2.2][12.5:12.9]";
printf CMDFILE " 'stara_jul27.dat' using (\$1):(\$9) ";
printf CMDFILE "     with points t '' lw 2  ";
printf CMDFILE " \n";

printf CMDFILE "quit \n";
close(CMDFILE);

$cmd = "gnuplot $cmdfile ";
printf "cmd is ..$cmd.. \n";
$ret = `$cmd`;
$giffile = $psfile;
$giffile =~ s/.ps/.gif/;
$cmd = "convert -rotate 90 $psfile $giffile";
printf "cmd is ..$cmd.. \n";
$ret = `$cmd`;


exit 0;
