图表峰值中的标签(tikzpicture)

图表峰值中的标签(tikzpicture)

我有图表(来自 CSV),我想在峰值中添加一些标签:

我有这张图

\begin{figure}[ht!]
\center
\begin{tikzpicture}[baseline]
    \begin{axis}[xlabel={Time}, ylabel={[a.u]},
                                width=15cm,
                                height=7cm,
                                xmin=1549.5,   xmax=1551.1,
                                ymin=-75,  ymax=-15,
                                legend pos=south west, grid=major,]
            \addplot[coordinate, color=blue] table[x=x,y=y] from {graphs/OSA123.txt};
\end{axis}
\end{tikzpicture}
\end{figure}

该 txt 文件是这里

我想获得这个: 我想将标签添加到图表中

非常感谢您抽出时间!

答案1

只需在山顶添加两个节点:

\begin{figure}[ht!]
\center
\begin{tikzpicture}[baseline]
    \begin{axis}[xlabel={Time}, ylabel={[a.u]},
                                width=15cm,
                                height=7cm,
                                xmin=1549.5,   xmax=1551.1,
                                ymin=-75,  ymax=-15,
                                legend pos=south west, grid=major,]
            \addplot[coordinate, color=blue] table[x=x,y=y] from {graphs/OSA123.txt};
            \node[above] at (1550.1,-33) {Data (video)};
            \node[above] at (1550.9,-33) {Data (voice)};
\end{axis}
\end{tikzpicture}
\end{figure}

在此处输入图片描述

相关内容