我一直在关注如何运行gnuplot的各种教程,我已经提出了这个脚本。到目前为止它已经足够好但是当我尝试更改xlabel
或ylabel
上的偏移量时,我会在终端中收到一条消息:
gnuplot> set xlabel "Applied Current [mA]" -0.3
^
line 0: ';' expected
我的大脑被震撼,所以我甚至在互联网上测试了xlabel和ylabel示例,并出现了同样的错误
#!/bin/bash
gnuplot << TOEND
# Set the output file
set terminal postscript eps color enhanced
set output 'fp.eps'
unset key
set title "Voltage as a Function of Current"
set noborder
set xtics axis
set ytics axis
set format x "%2.0f"
set format y "%2.0f"
u(x)=m*x+b
fit u(x) "nfp.dat" using 1:2 via m,b
v(x)=m*x+b
fit v(x) "wfp.dat" using 1:2 via m,b
set xzeroaxis linestyle 2 lt 1 lc 0
set xlabel "Applied Current [mA]" -0.3
set yzeroaxis linestyle 2 lt 1 lc 0
set ylabel "Voltage [mV]"
set xrange [ -15.00 : 15.00 ]
set yrange [ -20.0 : 20.0 ]
plot 'nfp.dat' using 1:2, \
v(x), 'wfp.dat' using 1:2, \
'sfp.dat' using 1:2
TOEND
convert -density 100 fp.eps fp.png
答案 0 :(得分:3)
我认为你错过了offset
标志。尝试:
set xlabel "Applied Current [mA]" offset -0.3