# Remove default tangent asymptotes and add dashed ones (tikz)

I think I know how to add dashed asymptotes \draw [dashed] (1st pt) -- (2nd pt) but before I have to remove the default asymptotes. Maybe one way is to truncate the domain in the neighborhoods of the asymptotes in order to have a domain composed of (in this case) 5 smaller sets, but I don't know how to do it. Also maybe there is a simpler solution.

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage{geometry}
\geometry{
showframe, % mostra l'area di lavoro
a4paper,top=2cm,bottom=3cm,left=2.5cm,right=3cm,% per regolare i bordi a piacimento
heightrounded,bindingoffset=5mm}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
ymin=-6,ymax=6,
xmin=-6,xmax=6,
xtick=\empty,
ytick=\empty,
extra x ticks={-4.71,-3.14,-1.57,0,1.57,3.14,4.71},
extra x tick labels={$-\frac{3\pi}{2}$,$-\pi$,$-\frac{\pi}{2}$,0,$\frac{\pi}{2}$,$\pi$,$\frac{3\pi}{2}$},
axis lines=center,
xlabel={$x$},
ylabel={$y$},
domain=-1.8*pi:1.8*pi, ]
\end{axis}
\end{tikzpicture}

\end{document}

• Use the next option: restrict y to domain=-10:10. It removes the asymptotes. – user91669 Nov 30 '17 at 13:08
• I did not know about that command! Thanks – sound wave Nov 30 '17 at 13:39

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
ymin=-6,ymax=6,
xmin=-6,xmax=6,
xtick=\empty,
ytick=\empty,
extra x ticks={-4.71,-3.14159,-1.5708,0,1.57,3.14,4.71},
extra x tick labels={$-\frac{3\pi}{2}$,$-\pi$,$-\frac{\pi}{2}$,0,$\frac{\pi}{2}$,$\pi$,$\frac{3\pi}{2}$},
axis lines=center,
xlabel={$x$},
ylabel={$y$},
domain=-1.8*pi:1.8*pi,
samples=1000]