# A plot using tikz is giving very odd results [closed]

I'm trying to include a plot of tan(x) in some student notes.

Here is my input (using ConTeXt):

``````\usemodule[newmat,tikz,pgfmath]
\usetikzlibrary[arrows]

\starttext

\starttikzpicture[scale=0.65]
\draw[-angle 60] (-9,0) -- (14,0) node[right] {\$x\$};
\draw[-angle 60] (0,-6) -- (0,6) node[above] {\$y\$};
\foreach \r in
{-6.28319,-3.14159,0.00000,3.14159,6.28319,9.42478,12.56637}
\draw[domain=\r-1.4:\r+1.4,line width=2pt] plot[samples=100]
(\x,{tan(\x r)});
\foreach \r in
{-7.8540,-4.7124,-1.5708,1.5708,4.7124,7.8540,10.9956}
\draw[dashed] (\r,-6) -- (\r,6);
\stoptikzpicture

\stoptext
``````

And here is the output:

Can anybody shed some light on this strange output?

-

## closed as too localized by lockstep, percusse, Paulo Cereda, egreg, Marco DanielJan 6 '12 at 23:21

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

The output is fine in normal LaTeX. So it seems ConTeXt related. –  Roelof Spijker Dec 16 '11 at 9:36
Since tikz uses the same math engine for both LaTeX and ConTeXt, I doubt that this is merely related to ConTeXt. Perhaps it is some bug in the tikz version shipped with ConTeXt - one that does not occur in the version used by whlt3? –  Christian Feuersänger Dec 16 '11 at 9:41
This produces the correct output for me on TL 2011, with ConTeXt but it produces a bunch of pgfmath errors in the console output: lots of 'function already exists' errors. So you need to check versions of pgf. –  Alan Munn Dec 16 '11 at 14:50