我想在 sp 处指定带有自定义标签的自定义刻度
\begin{axis}[
symbolic y coords={<{Critical point} at 2.138 ???>},
]
\addplot+[samples=100,domain=-2:2] {x^2};
\end{axis}
答案1
您必须使用extra y ticks
来指定您想要自定义的刻度并extra y tick style
指定它们的样式,例如:
\documentclass[border=2pt]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
extra y ticks={2.18},
extra y tick style={
grid=major,
yticklabel={$P_c$},
yticklabel style={yshift=0.7ex, anchor=east}}]
\addplot+[samples=100,domain=-2:2] {x^2};
\end{axis}
\end{tikzpicture}
\end{document}