为什么我的命令对gnuplot不起作用?

时间:2016-07-13 04:20:08

标签: linux gnuplot

我输入的文件 test.dat 包含

callbacks : {
      onImageUpload: function(files, editor, $editable) {
      sendFile(files[0],editor,$editable);
      }  
      }

我为gnuplot编写了脚本:

1 1
2 2
3 3 
4 4

但是当你尝试启动它时会发生错误:

gnuplot <<EOF
set term png size 1000,1000;
set output "out.png";
set arrow from graph 0,1 to graph 0,1.1 filled
set arrow from graph 1,0 to graph 1.1,0 filled
set tmargin 5
set rmargin 20
set border 3
set tics nomirror
set grid
set xtics font "Verdana,14"
set ytics font "Verdana,14"  
set nokey
set style line 1 lt 1 lw 3 pt 3 linecolor rgb "black"
set ylabel "Efficiency, %" offset 2,0,0 font "Verdana,14"
set xlabel "Cores, N" offset 0,0,0 font "Verdana,14"
func1(x) = x / 2
func2(x) = x * 2
plot "test.dat" u (func1($1)):(func2($2)) ls 1 smooth csplines;
EOF

1 个答案:

答案 0 :(得分:3)

美元符号被解释为启动shell变量。请改用column

gnuplot <<EOF
set term png size 1000,1000;
set output "out.png";
func1(x) = x / 2
func2(x) = x * 2
plot "test.dat" u (func1(column(1))):(func2(column(2))) ls 1 smooth csplines;
EOF