我喜欢将我能做的所有东西都存储在一个变量中,因为我制作的每个 gnuplot 脚本都会一次生成数十个图,并且它使事情更容易跟踪。这是一个图的示例(感兴趣的变量:)ytics
:
# Setup style
set terminal pngcairo dashed
unset key
set style line 1 pointtype 7 pointsize 0.3 linecolor rgb "black"
# Setup the plots' ytics
ytics_H2 = (0,0.002,0.004,0.006,0.008,0.010,0.012);
# Store the range for each variable
min_T = 200; max_T = 1800;
min_H2 = 0; max_H2 = 0.012;
# Plot
set output 'my_output_H2.png'
set ytics ytics_H2
set xrange [min_T :max_T ]
set yrange [min_H2:max_H2]
plot 'scatter.dat' using 1:2 with points linestyle 1
如您所见,仅打印最后一个刻度。ytics
如果我用它设置的向量替换变量,一切都会按预期工作。