4

I have the following snippet

\begin{tikzpicture}
    \draw[black, domain=0:10] plot({\x}, {cos(((9 - \x)/8)*3.141592)});
\end{tikzpicture}

When I compile the file, however, the plot just produces a straight line. I think this means that it's not sampling points correctly, but I'm not sure how to fix this.

Any insight would be appreciated.

1 Answer 1

9

The units of \x are the problem, if you tell tikz that you are trying to deal in radians then it will cooperate! Let tikz know to treat that number as a quantity in radians by including the letter 'r' before closing the parenthesis after cos:

\begin{tikzpicture}
    \draw[black, domain=0:10] plot({\x}, {cos(((9 - \x)/8)*3.141592 r)});
\end{tikzpicture}

Comes out like so: wavey

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .