# Placing a removable discontinuity in the graph of a function using TikZ (adding tick marks)

I would like to graph the function $y = \sqrt{x^{2} - 4}/\sqrt{x - 2}$ on the domain from -5 to 30. This function will be Sy = \sqrt{x + 2}$restricted to the open interval$(2, \infty)$. So, I would like an open circle at (2,0). Now, a horizontal grid line is passing through it, and the graph of the function is passing through it. I would like a dashed line drawn down to the x-axis from (2,0), and a tick mark there and below it the label "2." I would also like a tick mark below the x-intercept and below it the label "-2." \documentclass[10pt]{amsart} \usepackage{tikz} \usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings} \usetkzobj{all} \usepackage{pgfplots} \pgfplotsset{compat=1.11} \begin{document} \begin{tikzpicture} \begin{axis}[grid=both, xmax=41,ymax=6, axis lines=middle, restrict y to domain=-1.5:6.5, enlargelimits, axis line style={shorten >=-0.25cm,shorten <=-0.25cm,latex-latex}, ticklabel style={fill=white}] \addplot[domain=2:36,mark=none,samples=200] {sqrt(x + 2)} node[fill=white, below]{$y=\frac{x^{2} - 4}{\sqrt{x-2}}$}; \addplot[domain=-2:2,dashed,mark=none,samples=200] {sqrt(x + 2)}; \draw (axis cs:2,2) circle [radius=1.5pt]; \end{axis} \end{tikzpicture} \end{document}  ## 1 Answer To get an extra tick mark at specified coordinates without adding grid lines, use  extra x ticks={-2,2}, extra x tick style={grid=none}  To fill the circle with white, use fill=white  To get a vertical dashed line from (2,2) to (2,0), use \draw [dashed] (2,2) -- (2,0);  (no need for axis cs: if you're using \pgfplotsset{compat=1.11} or higher). \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.11} \begin{document} \begin{tikzpicture} \begin{axis}[grid=both, xmax=41,ymax=6, axis lines=middle, restrict y to domain=-1.5:6.5, enlargelimits, axis line style={shorten >=-0.25cm,shorten <=-0.25cm,latex-latex}, ticklabel style={fill=white}, extra x ticks={-2,2}, extra x tick style={grid=none} ] \addplot[domain=2:36,mark=none,samples=200] {sqrt(x + 2)} node[fill=white, below]{$y=\frac{x^{2} - 4}{\sqrt{x-2}}\$};

• @user143462: The label is placed directly below the end of the graph, as instructed. You can move it down further by setting below=3ex, for example, or you can place it above the plot by using above and adding clip=false to the axis options. For the other additional questions, please consult the PGFPlots manual (hint: the necessary options are described in section 4.10 "Scaling options"). – Jake Sep 16 '14 at 19:19
• @user143462: To get the same scaling for both axes while keeping the width and height unchanged, set axis equal. To get the same scaling for both axes and make the plot take up only the space needed to accommodate the axis limits, set axis equal image. To change the width or height, set width=<...> or height=<...>. – Jake Sep 16 '14 at 20:59