Q:

Strange Tikzpicture - asymptotes

Here is my code:
\documentclass[12pt]{article}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{graphicx,float}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usepackage{tikz}
\usetikzlibrary{calc} 
\usepackage{tkz-fct}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
        axis x line=middle, 
        axis y line=middle, 
        xtick={0,90,...,360},
        ymax=5, ymin=-5, ylabel=$y$, 
        xlabel=$x$,
        xlabel style={below right},
        ylabel style={above left},
        ]
    \addplot[domain=0:380, red, ultra thick, smooth, y filter/.expression = {x==90 ? inf:y}, y filter/.expression = {x==270 ? inf:y}] {2*tan(\x)};
    \legend{$y=2\tan x$}
\end{axis}
\end{tikzpicture}
\end{document}

I am trying to plot y=2tan(x), but the output looks quite strange and is incorrect when x is between 180 and 270 degrees. I have tried to implement what is suggested here, but it does not seem to have had any effect - perhaps I have not done it correctly. 
Can anyone suggest how this can be corrected?

A:

Now is correct.

\documentclass[12pt]{article}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
        axis x line=middle, 
        axis y line=middle, 
        xtick={0,90,...,360},
        ymax=5, ymin=-5, ylabel=$y$, 
        xlabel=$x$,
        xlabel style={below right},
        ylabel style={above left},
        samples = 200
        ]
    \addplot[domain=0:380, red, ultra thick, smooth] {2*tan(\x)};
    \legend{$y=2\tan x$}
\end{axis}
\end{tikzpicture}
\end{document}

