![PGFPlots 中的平滑样式和 \closedcycle 错误](https://linux22.com/image/270444/PGFPlots%20%E4%B8%AD%E7%9A%84%E5%B9%B3%E6%BB%91%E6%A0%B7%E5%BC%8F%E5%92%8C%20%5Cclosedcycle%20%E9%94%99%E8%AF%AF.png)
你能确认一下这个错误吗?
\documentclass{standalone}
\usepackage{tikz,pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[axis lines=middle,xmin=0,ymin=0]
\addplot[fill,opacity=0.5,cyan,domain=0:5,smooth] % smooth breaks \closedcycle
{1/x} \closedcycle;
\draw[-latex] (axis cs:3,2) node[label=above:Oops!] {} --
(axis cs:4.9,0.15) node[circle,draw=red,dashed,inner sep=5pt] {};
\end{axis}
\end{tikzpicture}
\end{document}
答案1
是的,看起来像是一个错误。你可能需要提交错误报告。
-- (current plot end|-{rel axis cs:1,0}) \closedcycle
您可以使用而不是仅仅 来获得正确的平滑图\closedcycle
。
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[axis lines=middle,xmin=0, xmax=6, ymin=0, axis on top]
\addplot[fill,opacity=0.5,cyan,domain=0.2:5,smooth]
{1/x} -- (current plot end|-{rel axis cs:1,0}) \closedcycle;
\end{axis}
\end{tikzpicture}
\end{document}