Gnuplot - 在一个图中绘制多个文件

时间:2014-12-02 17:21:11

标签: regex bash gnuplot

我正在用bash编程,我尝试用gnuplot从4个文件中制作一个图形。 我的文件在第一列中包含日期,在其余10列中包含不同深度的海洋温度。我得到错误,第0行:无效命令和第0行:需要常量表达式。

MyVar="THO"         
MySeas="Annual Win Spr Aut Sum"        
MyWorkDir=/work/InterAnnual    

echo "change dir"        
cd $MyWorkDir             
MyFileArx1=0001_field_${MyVar}.grb.regular      
MyFileArx21=0021_field_${MyVar}.grb.regular    
MyFileArx25=0025_field_${MyVar}.grb.regular    
MyFileArx26=0026_field_${MyVar}.grb.regular    

for MySeasName in ${MySeas} ;do       
MyFile1=${MyFileArx1}_sm_${MySeasName}.col.dat       
MyFile21=${MyFileArx21}_sm_${MySeasName}.col.dat       
MyFile25=${MyFileArx25}_sm_${MySeasName}.col.dat       
MyFile26=${MyFileArx26}_sm_${MySeasName}.col.dat      

gnuplot << EOF       
set term postscript eps enhanced color solid        
set out 'InterAnnual.${MySeasName}.6.eps'       
set key right top            
set grid      
set xrange [ 800:2000 ]          
set size 1, 0.5        
set xlabel "year"      
set ylabel " T (C) "       
plot "${MyFile1}" u 1:11 t 'Level-6 ${MySeasName} mil0001' w l lt, \       
"${MyFile21}" u 1:11 t 'Level-6 ${MySeasName} mil0001' w l lt, \      
"${MyFile25}" u 1:11 t 'Level-6 ${MySeasName} mil0001' w l lt, \     
"${MyFile26}" u 1:11 t 'Level-6 ${MySeasName} mil0001' w l lt     
EOF              
done

`

1 个答案:

答案 0 :(得分:0)

当我添加gnuplot部分时脚本工作:set multiplot。 例如:

gnuplot << EOF    
set multiplot    

......然后是其余部分。