我在文档中使用了以下代码:
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel=$a$,
ylabel=$b$,
]
\addplot[blue,mark=*,mark options={fill=blue},nodes near coords,only marks,
point meta=explicit symbolic,
visualization depends on={value \thisrow{anchor}\as\myanchor},
every node near coord/.append style={anchor=\myanchor}
] table[meta=label] {
x y label anchor
100 152 {Long label 1} south
200 180 {Long label 2} east
110 150 {Long label 3} west
};
\end{axis}
\end{tikzpicture}
\end{document}
一切都很完美,但现在我想知道如何擦除圆圈并保留标签?
答案1
只需将所有与标记相关的内容替换为no marks
。
注意:实际上,pgfplots
没有名为 的选项no marks
,但它no markers
确实存在。该选项no marks
继承自 TikZ。对我来说,这是违反直觉的,因为only marks
应该是no marks
而不是 的自然对立面no markers
。
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel=$a$,
ylabel=$b$,
]
\addplot[blue,no marks,nodes near coords,only marks,
point meta=explicit symbolic,
visualization depends on={value \thisrow{anchor}\as\myanchor},
every node near coord/.append style={anchor=\myanchor}
] table[meta=label] {
x y label anchor
100 152 {Long label 1} south
200 180 {Long label 2} east
110 150 {Long label 3} west
};
\end{axis}
\end{tikzpicture}
\end{document}