GNUPLOT错误:在bash shell中对一列dat文件使用算术运算时

时间:2016-12-01 22:49:33

标签: bash math gnuplot

 #!/bin/bash

gnuplot -persist <<-EOFMarker

reset
set terminal svg enhanced size 500,500 
set output 'plot.svg'
set   autoscale                        # scale axes automatically
unset log                              # remove any log-scaling
      unset label                            # remove any previous labels
      set xtic auto                          # set xtics automatically
      set ytic auto                          # set ytics automatically

set ylabel "Loading (mmol/gm)"
set xlabel "Pressure (kPa)"
set key left top
set key autotitle columnhead
set grid

plot "all_isotherm_15.dat" using (($2)/100000):3 title 'Simulation273K' with linespoints , \
"all_isotherm_15.dat" using (($2)/100000):5 title 'Simulation298K' with linespoints 
EOFMarker

我收到以下错误

gnuplot> plot "all_isotherm_15.dat" using (/100000):3 title 'Simulation273K' with linespoints , "all_isotherm_15" using (/100000):5 title 'Simulation298K' with linespoints 

       ^

 line 0: invalid expression 

1 个答案:

答案 0 :(得分:1)

你将bash解释为$ 2作为字符串。由于它们没有定义,它们被任何东西取代。

为什么不直接使用gnuplot作为shell脚本的解释器,即将文件作为

启动
#!/usr/bin/gnuplot -persist

reset
...