如何在行旁边的 Gnuplot 中设置标签但包括​​行的颜色

how to set a label in Gnuplot next to line but include colour of line

我试图在 gnuplot 中将行的各个键放在每行旁边。我想我可以做这个我的设置标签。但是,我无法获得线条的颜色和类型。这就是我正在尝试的:

key label "C=#FFC000" at graph 0.015,0.955

我想让它读作 C=(aline,颜色为 #FFC000)

谢谢,

没有自动的方法,你必须手动完成,并且你必须分别设置文本标签和一段线:

set angle degrees

set label "Label" at 1,1 right
set arrow from 1,1 to 1.1, 1 linewidth 3 linecolor rgb "#FF0000" nohead

set label "Twwwwoooooooooo" at 1,2 right
set arrow from 1,2 to 1.1, 2 linewidth 3 linecolor rgb "#00FF00" nohead

set label "WithOffset" at 2,2 right offset -1, 0
set arrow from 2,2 to 2.1, 2 linewidth 3 linecolor rgb "#0000FF" nohead

set label "Rotated" at 2,1 right rotate by 45
set arrow from 2,1 to 2+0.1*cos(45), 1+0.1*sin(45) linewidth 3 linecolor rgb "#FFC000" nohead

right 使文本标签右对齐,offset -1, 0 使文本向左移动 1 个字符宽度。 (这比处理坐标更方便)

最后的label/arrow演示了你也可以旋转标签。但是,当文本简单地旋转 45° 时,线是在两点之间绘制的。因此,除非 x/y 个单位的比率不为 1 (set size ratio -1),否则该线不会以 45° 角显示,否则您必须进行更多数学运算。

这是一个结果: