以下是我的代码。我使用了 axis 环境以获得更好的轴样式。我尝试在 g^W=g^L(y 轴上的一个点)处添加节点,但 axis 环境似乎切断了轴外的所有内容。我该怎么办?
\documentclass[11pt]{article}
\usepackage{pgfplots}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[scale = 1.2]
\begin{axis}[xmin=0,xmax=10,ymin=0,ymax=7,
axis lines = left, axis line style = thick, unit vector ratio=1 1 1, xtick={0,8},
xticklabels = {$p^w=0$, $p^w=1$},
ytick={1.5,3,5.5},
yticklabels = {$g^L-\beta$,$g^W=g^L$,$g^w+\alpha$}]
\addplot[mark=none, dashed] coordinates {(8, 0) (8, 7)};
\addplot[domain=0:8, dashed] {1.5};
\addplot[domain=0:8, dashed] {3};
\node[black,right] at (axis cs:8,1.5){\small{$W=0$}};
\node at (axis cs:8,1.5) [circle, scale=0.3, draw=black!80,fill=black!80] {};
\node at (axis cs:8,3) [circle, scale=0.3, draw=black!80,fill=black!80] {};
\node at (0,3.5) [circle, scale=0.3, draw=black!80,fill=black!80] {};
\end{axis}
\end{tikzpicture}
\caption{A caption.}
\end{figure}
\结束{文档}
答案1
如果你添加
clip mode=individual
对于轴选项,图表(带有addplot
)将被剪裁,但节点不会。
否则,clip = false
将避免任何剪辑。
附言:您需要\pgfplotsset{compat=1.9}
添加或任何内容,以避免意外......