Gnuplot 在x轴顶部设置多个标签

Gnuplot 在x轴顶部设置多个标签,gnuplot,Gnuplot,在我之前的帖子中得到答案后,我一直在尝试标记由虚线分隔的部分。我使用了x2label,但发现如果我多次使用它,数据就会被替换,尽管它们位于不同的位置。以下是脚本: set term x11 persist set title "Animation curves" set xlabel "Time (secs.)" set ylabel "Parameter" set x2label "Phoneme1" offset -35 set pointsize 2 set key off set

在我之前的帖子中得到答案后,我一直在尝试标记由虚线分隔的部分。我使用了x2label,但发现如果我多次使用它,数据就会被替换,尽管它们位于不同的位置。以下是脚本:

set term x11 persist

set title "Animation curves"

set xlabel "Time (secs.)"
set ylabel "Parameter"

set x2label "Phoneme1" offset -35
set pointsize 2
set key off
set style line 2 lt 0 lc 1 lw 2
plot [0.04:0.15] "curve.dat" u 1:2 smooth csplines ls 1, "" u 1:($2-0.2):(0):(0.3) w   vectors nohead ls 2, \
                "curve.dat" u 1:2 with points
输出如下

我想给Phoneme1、Phoneme2……等等贴上标签。。在每个片段的顶部。我该怎么做?正如我在先前的帖子中建议我玩线“u1:($2-0.2):(0):(0.3)w向量nohead ls 2以获得从上到下的垂直线。但这也不起作用。如何从上页边距到下页边距的线条?谢谢。

水平线 水平线可以通过将yrange设置为显式值来完成。否则,gnuplot将尝试在直线和轴之间获得一些空间。您可以选择值

set yrange [0.3:1.2]
然后,只需使用如下方向修改向量:

"" u 1:(0.3):(0):(1.2) w vectors nohead ls 2
(完整的脚本见下文)

章节的标签 使用数据集执行此操作的快速方法如下:

set key off
set style line 2 lt 0 lc 1 lw 2
set yrange [0.3:1.2]
plot [0.04:0.15] "Data.csv" u 1:2 smooth csplines ls 1, \
                 "" u 1:(0.3):(0):(1.2) w vectors nohead ls 2, \
                 "" u ($1+0.005):(1):(sprintf("P %d", $0)) w labels
但是,这可能不是您想要的外观。您可以考虑修改数据文件,使其也包含一些有关标签的信息,如:

#x-value y-value x-label y-label label
0.06 0.694821399177 0.65 0.1 Phoneme1
0.07 0.543022222222 0.75 0.1 Phoneme2
然后,标签行看起来就像:

"" u 3:4:5 w labels
然后,完整的绘图如下所示:

是否可以从P1而不是P0开始标签?@zingy:Give
sprintf(“p%d”,0+1美元)