标记使用 gnuplot 绘制的垂直线

时间:2021-06-30 10:21:56

标签: gnuplot

我想在 gnuplot 中使用 set arrow 命令在顶部边框标记垂直线。如何才能做到这一点?例如我在附图中的 x=-3.8 处画了一条垂直线。我想将标签放置在此垂直线与绘图顶部边框相交的顶部边框处。enter image description here

以这种方式标记垂直线是最佳做法吗?我选择这种方式是因为在垂直线与 x 轴相交的点附近的图中,已经有一个数字。所以我别无选择,只能将标签放在顶部边框。

1 个答案:

答案 0 :(得分:2)

请查看手册或在 gnuplot 控制台中输入 help label。您可以将标签设置为带有偏移量的特定坐标。

reset session

xPos = -3.8
set arrow 1 at xPos, graph 0 to xPos, graph 1 nohead lc "red" dt 4
set label 1 at xPos, graph 1 "myLabel" offset 0.5,-0.7

plot sin(x)

enter image description here