是否可以将文本后缀(在我的情况下为单位)附加到 PGFPlots 轮廓图中的所有标签?
例如,考虑以下图表:
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[view = {0}{90}]
\addplot3[
contour gnuplot={
draw color=black,
contour label style={every node/.append style={text=black}},
% somehow append "ms" to all labels
},
samples=50
] {x^2+y};
\end{axis}
\end{tikzpicture}
\end{document}
我想象它看起来如下所示:
答案1
您可以使用以下命令指定标签内容contour/label node code/.code
:
\documentclass{article}
\usepackage{pgfplots}
\pgfkeys{/pgf/number format/relative round mode=fixed}
\pgfplotsset{
contour/label node code/.code={%
\node{\pgfmathprintnumber{#1}\,ms};%
}%
}
\begin{document}
\begin{tikzpicture}
\begin{axis}[view = {0}{90}]
\addplot3[
contour gnuplot={
draw color=black,
contour label style={
every node/.append style={text=black}
}
},
samples=50
] {x^2+y};
\end{axis}
\end{tikzpicture}
\end{document}