我想绘制一个具有y=x
渐近线的函数。在下面的代码中,我$\sqrt{x^2 + x}$
绘制了它。它看起来不像y=x
是它的渐近线。是否有xmin
、xmax
、ymin
、ymax
或 的值unit vector ratio={a b}
来获得它的视觉表现?是否有更合适的函数?(我希望这样的函数f
至少在区间上是连续的$[0, \infty)$
,并且$f(0) = 0$
。)
\documentclass[10pt]{amsart}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
\begin{axis}[height=3.5in,width=3.5in, clip=false,
xmin=-2,xmax=12,
ymin=-2,ymax=11,
restrict y to domain=-2:11,
xtick={\empty},ytick={\empty},
enlargelimits={abs=0.5cm},
axis lines=middle,
axis line style={latex-latex},
xlabel=$x$,ylabel=$y$,
xlabel style={at={(ticklabel* cs:1)},anchor=north west},
ylabel style={at={(ticklabel* cs:1)},anchor=south west}
]
\addplot[samples=501, domain=0:9.25, blue] {sqrt(x^2 + x)} node[anchor=south east, pos=0.95, font=\tiny]{$y = \sqrt{x^{2} + x}$};
\addplot[samples=2, domain=0:10, dashed, -latex] {x} node[anchor=north west, pos=1, font=\tiny]{$y = x$};
\end{axis}
\end{tikzpicture}
\end{document}