#!/usr/bin/perl
# 


$title = "SNAP 8B filter set";
$cmdfile = "make_plots_a.gnu";
$psfile = "make_plots_a.ps";
open(CMDFILE, ">$cmdfile") || die("can't open $cmdfile");
printf CMDFILE "set output '$psfile' \n";
printf CMDFILE "set term postscript color \n";
printf CMDFILE "set grid \n";
printf CMDFILE "set key top left \n";
printf CMDFILE "set xlabel 'Wavelength (nm)' \n";
printf CMDFILE "set ylabel 'Filter transmission'  \n";
printf CMDFILE "set title '$title'  \n";
printf CMDFILE "plot [100:2000][0.0:1.3] ";
printf CMDFILE " 'b8_2.filter' using ((\$1*0.1)):(\$2) ";
printf CMDFILE "     with linespoints t 'filter 8B2' pt 6 ps 0.4 lw 3  ";
printf CMDFILE ", ";
printf CMDFILE " 'b8_6.filter' using ((\$1*0.1)):(\$2) ";
printf CMDFILE "     with linespoints t 'filter 8B6' pt 6 ps 0.4 lw 3  ";
printf CMDFILE ", ";
printf CMDFILE " 'b8_8.filter' using ((\$1*0.1)):(\$2) ";
printf CMDFILE "     with linespoints t 'filter 8B8' pt 6 ps 0.4 lw 3  ";
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;
