Pages

mardi 17 janvier 2012

plot in shell with gnuplot

http://t16web.lanl.gov/Kawano/gnuplot/intro/working-e.html

1) create one script to plot one figure: the script plot_mrb.plt

#!/usr/bin/gnuplot

## This is to plot one figure use a file mrb18248101.txt and its 5th column

# this line imporant: will save the figures to the computer
set terminal postscript eps color enhanced
set xlabel "18248101"
set ylabel "MRB"
set title "MRB for station 18248101"
set size 1.5, 1.5 #set xrange [ 0 : 20 ]
#set yrange [ 0 : 2 ]
#set mxtics 5
#set mytics 5
#set xtics 5
#set ytics 0.5

 plot "mrb18248101.txt" using 1:5 notitle w l
set output "mrb18248101.eps"

 2) plot many figures: then use the other script

#!/bin/tcsh
foreach sta ( `cat stations` )
 echo $sta
 # to get the interested data
 grep "MRB $sta" parametres_gins | sort -k 1 > "mrb$sta.txt"
# to plot one data
./plot_mrb.plt
# to plot other data
sed "s/18248101/$sta/g" plot_mrb.plt | gnuplot

end

Aucun commentaire:

Enregistrer un commentaire