![在 pgfplot 中使用 pos 选项时节点不出现](https://linux22.com/image/246518/%E5%9C%A8%20pgfplot%20%E4%B8%AD%E4%BD%BF%E7%94%A8%20pos%20%E9%80%89%E9%A1%B9%E6%97%B6%E8%8A%82%E7%82%B9%E4%B8%8D%E5%87%BA%E7%8E%B0%20.png)
我想使用路径修饰符将节点放置在图上:node[pos=0.5] {node text};
。pgfplots
手册清楚地描述了如何做到这一点,但我的节点没有出现。我的缩放比例会不会是这里的问题(它由样式应用input filter
)?
\documentclass{article}
\usepackage[a2paper,landscape,margin=1cm]{geometry}
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=1.5}
\pgfmathsetmacro{\smin}{4000}
\pgfmathsetmacro{\smax}{9200}
\pgfmathsetmacro{\hmin}{2000}
\pgfmathsetmacro{\hmax}{3900}
\pgfplotstableset{input filter/.style ={y expr=\thisrowno{1}/1e3}}
\begin{document}
\pagestyle{empty}
\noindent\begin{tikzpicture}
\begin{axis}[xmin=\smin,xmax=\smax,width=52cm,
ymin=\hmin,ymax=\hmax,height=38cm,
scale only axis,
major tick length={0pt},
minor tick length={0pt},
xticklabel={\pgfmathparse{\tick/1e3}\pgfmathresult},
yticklabel={\pgfmathparse{\tick}\pgfmathresult},
axis lines*=none
]
\addplot table[input filter] {
5575.75757575757575779 2010304.18052640024086
6311.11111111111111116 2284412.95212492412338
7886.86868686868686851 2900069.5315761277061
9200 3795110.22478821340428
} node[pos=0.5] {asdf};
\end{axis}
\end{tikzpicture}\\
\end{document}
我也尝试使用该库来放置节点decorations.markings
:
\usetikzlibrary{decorations.markings}
\addplot[postaction={decorate},
decoration={markings,mark=at position 0.5 with \node {asdf};}
] table[input filter] {
5575.75757575757575779 2010304.18052640024086
6311.11111111111111116 2284412.95212492412338
7886.86868686868686851 2900069.5315761277061
9200 3795110.22478821340428
};
并且节点也没有出现。其他位置设置,例如at position 1cm
也没有在绘图上放置节点。