I have put a restriction on the y values but I still get a `dimension too large' error. Can anyone suggest how to prevent the error?
\documentclass[12pt]{article}
\usepackage{amsmath,amsthm,amssymb,amsfonts}
\usepackage{graphicx,float,wrapfig}
\usepackage{array}
\usepackage{microtype}
\usepackage{tikz,pgfplots}
\usetikzlibrary{calc}
\usetikzlibrary{math}
\begin{document}
\begin{tikzpicture}[scale=1.3]
\begin{axis}[
ymin=-7,ymax=7,
xmin=-1,xmax=361,
axis lines=center,
xtick={0,45,90,...,360},
domain=-1:361,
samples=1000]
\addplot [dashed] {tan(x)};
\addplot [restrict y to domain=-7:7,line width=1pt] {tan(x)};
\end{axis}
\end{tikzpicture}
\end{document}