我在 Gnuplot 中创建重叠图,因为我混合了法线图和参数图(以及 pm3d 地图和参数曲面)。这大部分都很好,除了一件事:如果两个图都有标题,则图例通常会重叠。一个典型的例子如下所示:
#legends.gp
set term pngcairo enhanced color linewidth 1.5 dashed dashlength 1.4 rounded
set output "legends.png"
set title "legends test"
set multiplot
# make a box around the legend
set key box
set border 15 lw 1
# fix the margins, this is important to ensure alignment of the plots.
set lmargin at screen 0.15
set rmargin at screen 0.98
set tmargin at screen 0.90
set bmargin at screen 0.15
set xlabel "x"
set ylabel "sin(x)"
set xrange[0:2*pi]
set yrange[-1:1]
set grid x y
# add single tic at 0.62
set xtics add ("x0" 0.62)
# main plot command
plot sin(x) title "sinus"
# turn everything off
set format x "" #numbers off
set format y ""
set xlabel "" #label off
set ylabel ""
set border 0 #border off
unset xtics #tics off
unset ytics
unset grid #grid off
unset title #title off
#plot vertical line at 0.62
set parametric
plot 0.62,t ls 2 lw 2 title "parametric Line"
unset parametric
unset multiplot
我现在的问题是,是否有一种简单的、主要是自动的方法来为多个图创建一个图例?
PS 抱歉,我最终通过显示更多功能使示例文件变得比它必须的更复杂,希望对未来的读者有所帮助。