下面有两张图片。一张是采样 200,另一张没有任何采样。如您所见,第一张图像有一个漂亮的箭头,而第二张图像中的线条超出了实际箭头,导致箭头尖端很奇怪。这使用箭头LaTeX
,并对宽度和高度进行了一些修改以使其更大。
具有过度采样的错误版本:
\documentclass{article}
\begin{document}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,angles, decorations.pathmorphing}
\begin{tikzpicture}
\draw[line width=0.5pt, -{Latex[length=6pt,width=4pt]}] (-3.5,0)--(3.5,0)node[above, xshift=-0.12cm]{$x$};
\draw[line width=0.5pt, -{Latex[length=6pt,width=4pt]}] (0,-3.5)--(0,3.5)node[right, yshift=-0.15cm]{$y$};
\draw[xscale=1, yscale=1, line width=1pt, domain=-3.5:-0.6,
smooth,variable=\x, bluegraph ,latex-latex,samples=200] plot ({\x},{(-2/\x)});
\draw[xscale=1, yscale=1, line width=1pt, domain=0.6:3.5,
smooth,variable=\x, bluegraph ,latex-latex,samples=200] plot ({\x},{(-2/\x)});
\foreach \x/\y in {-1/2} {
\fill (\x,\y) circle (3pt);
\node[above left] at (\x,\y) {$(\x,\y)$};
}
\end{tikzpicture}
\end{document}
未采样的好版本:
\documentclass{article}
\begin{document}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,angles, decorations.pathmorphing}
\begin{tikzpicture}
\draw[line width=0.5pt, -{Latex[length=6pt,width=4pt]}] (-3.5,0)--(3.5,0)node[above, xshift=-0.12cm]{$x$};
\draw[line width=0.5pt, -{Latex[length=6pt,width=4pt]}] (0,-3.5)--(0,3.5)node[right, yshift=-0.15cm]{$y$};
\draw[xscale=1, yscale=1, line width=1pt, domain=-3.5:-0.6,
smooth,variable=\x, bluegraph ,latex-latex] plot ({\x},{(-2/\x)});
\draw[xscale=1, yscale=1, line width=1pt, domain=0.6:3.5,
smooth,variable=\x, bluegraph ,latex-latex] plot ({\x},{(-2/\x)});
\foreach \x/\y in {-1/2} {
\fill (\x,\y) circle (3pt);
\node[above left] at (\x,\y) {$(\x,\y)$};
}
\end{tikzpicture}
\end{document}
- 为什么增加采样会导致这种情况发生?
- 我该怎么做才能防止这种情况发生,而无需手动尝试找到采样精度和箭头美观度之间的完美平衡?