Gnuplot,Multiplot:使用单个图例框混合法线和参数绘图?

Gnuplot,Multiplot:使用单个图例框混合法线和参数绘图?,gnuplot,Gnuplot,我在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 m

我在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
我现在的问题是,有没有一种简单的、几乎是自动的方法来为多个情节创建一个图例


另外,很抱歉,我通过展示更多的功能,使示例文件变得更加复杂,希望对未来的读者有所帮助。

这里有一个对我有用的非常肮脏的黑客程序。更改:

plot sin(x) title "sinus"
致:

然后绘制不带标题的参数线(例如,
notitle
而不是
title“参数线”

这是因为gnuplot在绘制时忽略了NaN的元素——本质上,我们在上面绘制的第二件事情只是在图例中添加了一个元素。我将线型等指定为与参数化打印线型/类型相同,以便它在图例中正确显示。据我所知,这是做这种事情的唯一方法

当然,您可以对其进行编辑,以便两者都以参数化方式打印,并放弃整个multiplot业务

set xrange [0:2*pi]
set yrange [-1:1]
set parametric
set trange [-10:10]
plot t,sin(t) title "Hello", 0.62,t title "World"

这可能是“更清洁”的解决方案…(但使用gnuplot“魔法”的乐趣更少)

来自gnuplot信息手册:

从图形底部到顶部绘制垂直线的步骤 x=3,使用:
将箭头从3设置为3,将图0设置为3,将图1设置为nohead

起初我不喜欢这个答案,但现在我已经使用了几次
NaN
-技巧,效果非常好。谢谢你的回答!
set xrange [0:2*pi]
set yrange [-1:1]
set parametric
set trange [-10:10]
plot t,sin(t) title "Hello", 0.62,t title "World"