1
我输入文件TEST.DAT包含为什么我的命令不适用于gnuplot?
1 1
2 2
3 3
4 4
我写的剧本gnuplot的:
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
但是当你尝试启动时出现错误:
gnuplot> plot "test.dat" u (func1()):(func2()) ls 1 smooth csplines;
line 0: invalid expression
或者,使用'\\'来转义'$'标志。 – Joce
@Joce是的,但是我更喜欢每当自动创建脚本时使用'column',因为无论您如何调用gnuplot或准备脚本,它总是能够工作。 – Christoph