I would like the code that instructs TikZ to plot the asymptotes to the graph for the rational function y=(x^{2})/(x^{2}-9)
. What is the code for plotting these lines as a dashed lines with arrowheads? These should be a little shorter than the axes.
The labels x=-3
and x=3
are to be typeset on the vertical asymptotes. Preferably, they would be typeset towards the bottom arrowheads, going upwards. (How do I label the axes? y
is to be typeset to the right and above the top arrowhead on the y-axis, and x
is to be typeset to the right and below the right arrowhead on the x-axis.)
\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\begin{document}
\begin{tikzpicture}
\begin{axis}[width=4in,axis equal image,
axis lines=middle,
xmin=-15,xmax=15,
ymin=-5,ymax=5,
restrict y to domain=-10:10,
enlargelimits={abs=1cm},
axis line style={latex-latex},
ticklabel style={font=\tiny,fill=white},
ytick={-2},xtick={-2}
]
\addplot[samples=250,domain=-15:15] {(x^2)/(x^2-9)};
\draw[dashed,latex-latex] ({{1,0}}|-{{axis description cs:1,1}})
-- ({{1,0}}|-{{axis description cs:1,0}});
\end{axis}
\end{tikzpicture}
\end{document}
(x+2)/(x-1)
to your desired function((x)^2)/((x)^2)-9)
and change the domain as desired. You can addshorten <=1.0ex, , shorten >=1.0ex
option to to thedashed
line to get them shorter than the axis.PGFplots
example where you list lots of small things which you would like changed. I'd recommend taking a look at the PGFplots manual and really trying to understand the code instead of having others modify it for you.shorten<=1ex, shorten>=1ex
and the page I can find to label the vertical asymptotes x=-3 and x=3 oging upwards?