2

I am new to tikz. I am using the following code (Polar co-ordinates)

\def\radius{12cm}

\begin{tikzpicture}

\foreach \x in {0,10,...,350}
  {

\draw  [shading=radial, inner color=white, outer color=red!15,draw=white]  
(\x:\radius) circle (1);

  };

\foreach \x in {0,10,...,350}

  {

\node[scale=3.4] at (360-\x+90:\radius) {t};

  };



\end{tikzpicture}

The code works.

But when I use the code (converting to Cartesian co-ordinates)

\foreach \x in {0,10,...,350}
  {

\node[scale=3.4] at (\radius\*cos(360-\x+90), \radius\*sin(360-\x+90)) {t};

  };

error is generated. My search resulted in

TikZ does not use square coordinates but polar one, how to change it in order to use Cartesian coordinates?

But I am unable to do that. How it can be done? Thanks in advance.

5

You need to protect the math operation with braces. Then your code works as is (after removing the backslash before *)

\def\radius{12cm}
\begin{tikzpicture}
\foreach \x in {0,10,...,350}{
\node[circle,shading=radial, inner color=white, outer color=red!15,scale=3.4] 
    at ({\radius*cos(360-\x+90)},{\radius*sin(360-\x+90)}) {t};
}
\end{tikzpicture}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.