我用完全相同的方式绘制了一些图表:
使用代码:
set style line 1 lt 1 lw 0.9 pt 1 ps 0.9 lc rgb "navy"
set style line 2 lt 2 lw 0.9 pt 2 ps 1.1 lc rgb "red"
set style line 3 lt 3 lw 0.9 pt 3 ps 1.1 lc rgb "blue"
set style line 4 lt 4 lw 0.9 pt 4 ps 1.1 lc rgb "olive"
set style line 5 lt 5 lw 0.9 pt 5 ps 1.1 lc rgb "black"
set style line 6 lt 6 lw 0.9 pt 6 ps 1.1 lc rgb "gray20"
set terminal postscript eps enhanced
set encoding utf8
set multiplot
plot 'solPIhc10^0.dat' with linespoints title "{/Symbol l^2} = 10^{0}", \
'solPIhc10^1.dat' with linespoints title "{/Symbol l^2} = 10^{1}", \
'solPIhc10^-1.dat' with linespoints title "{/Symbol l^2} = 10^{-1}", \
'solPIhc10^-2.dat' with linespoints title "{/Symbol l^2} = 10^{-2}", \
'solPIhc10^-3.dat' with linespoints title "{/Symbol l^2} = 10^{-3}", \
'solPIhc10^-4.dat' with linespoints title "{/Symbol l^2} = 10^{-4}", \
'solPDhc.dat' with points ls 5 title "h1 (PD)"
set xlabel "x (m)"
set ylabel "h(W/m^2°C)"
set xrange [0:0.04]
set yrange [-500:2000]
unset multiplot
但是,有几次我的图表被正确绘制,其他时候我收到了这个烦人的消息
我该如何克服这个问题?
我假设您正在 gnuplot 控制台中工作并使用交互式终端,例如
wxt
或 qt
等用于测试脚本在窗口中立即输出。
但是,当您set term postscript
时,您还需要通过set output
定义文件(选中help output
)。
一个最小的例子是(我通常用
reset session
启动脚本)
reset session
set terminal postscript eps enhanced
set output "SO76969492.eps"
plot sin(x)/x # or whatever
set output # close the file
正确的顺序是:
set terminal postscript enhanced eps
set output 'something.eps'
set multiplot
set xlabel "x (m)"
# ...
plot 'your-file.dat'
# other plots
unset multiplot
unset output # or set output or set output '/dev/null' or ...
set term qt # or wxt; if you want to return to interactive mode
注意事项
在您的示例中,您不必使用
multiplot
。 plot <first>, <second>, <third>...
就够了。
您必须在
xlabel
命令之前设置plot
等。