# [pstricks] Sketching the graph of the tangent function

Eduardo eduardo.morais at videotron.ca
Tue Oct 10 16:49:08 CEST 2006

Hi Ricky,

Try this: (you have to use pstricks-add)

\begin{figure}[H]
\begin{center}
\begin{pspicture}(-5.0,-2.5)(5.0,3.5)

\uput[-90](4.9,-0.1){$x$} \uput[0](0.05,2.6){$y$}
\uput[0](-0.5,0.666666){$\scriptstyle 1$}
\uput[0](-0.5,1.333333){$\scriptstyle 2$}
\uput[0](-0.5,2.0){$\scriptstyle 3$}
\uput[0](0.0,-0.666666){$\scriptstyle -1$}
\uput[0](0.0,-1.333336){$\scriptstyle -2$}
\uput[0](0.0,-2.0){$\scriptstyle -3$}

\uput[-90](4.3,-0.05){${\scriptstyle2}\pi$}
\uput[90](3.45,-0.05){$\frac{3\pi}{2}$}
\uput[-90](2.1,-0.05){$\pi$}
\uput[90](1.25,-0.05){$\frac{\pi}{2}$}
\uput[90](-4.35,-0.01){${\scriptstyle-2}\pi$}
\uput[-90](-3.55,-0.01){${\scriptstyle-}\frac{3\pi}{2}$}
\uput[90](-2.2,-0.01){${\scriptstyle-}\pi$}
\uput[-90](-1.35,-0.01){${\scriptstyle-}\frac{\pi}{2}$}

\psset{algebraic=true, unit=0.666667, labelFontSize={\footnotesize}}
\psline[linestyle=dashed, dash=3pt 2pt](-4.712389,-3.5)(-4.712389,3.5)
\psline[linestyle=dashed, dash=3pt 2pt](-\psPiH,-3.5)(-\psPiH,3.5)
\psline[linestyle=dashed, dash=3pt 2pt](\psPiH,-3.5)(\psPiH,3.5)
\psline[linestyle=dashed, dash=3pt 2pt](4.712389,-3.5)(4.712389,3.5)

\psplot[linewidth=1.0pt]{-6.5}{-5.0}{sin(x)/cos(x)}
\psplot[linewidth=1.0pt]{-4.425}{-1.858}{sin(x)/cos(x)}
\psplot[linewidth=1.0pt]{-1.283}{1.283}{sin(x)/cos(x)}
\psplot[linewidth=1.0pt]{1.858}{4.425}{sin(x)/cos(x)}
\psplot[linewidth=1.0pt]{5.0}{6.5}{sin(x)/cos(x)}

\psaxes[labels=none, dx=\psPiH, xunit=\psPi, arrowscale=1.5, labelsep=3pt,%
showorigin=false, ticksize=-3pt 0]{->}(0,0)(2.3,4.0)
\psaxes[labels=none, dx=\psPiH, xunit=\psPi, arrowscale=1.5, labelsep=3pt,%
showorigin=false, ticksize=0 3pt](0,0)(-2.3,-3.5)
\end{pspicture}
\caption{Graph of $\tan$.}\label{graph:tan}
\end{center}
\end{figure}

You can see lots of examples in <http://tug.org/PSTricks> (Index and Examples)

Eduardo.

On Tuesday 10 October 2006 10:21, Richard Hensh wrote:
> Has anyone worked out a nice way to sketch the
>
> 	y = tan(x)
>
> and transformations of such.
>
> Thanks
> ricky
>
> _______________________________________________
> pstricks mailing list
> pstricks at tug.org
> http://tug.org/mailman/listinfo/pstricks