[Tex/LaTex] Draw circle with three colours in tikz

circlesdrawtikz-pgf

I would like to have a circle where the circumference is coloured with three different colours, something like the following but a line and with only three colours:

Like this

I initially tried

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\pagestyle{empty}
\begin{document}

\begin{tikzpicture}
    \draw [red] (0,0) arc [radius=1, start angle=0, end angle=120];
    \draw [green] (1,0) arc [radius=1, start angle=120, end angle=240];
    \draw [blue] (0,0) arc [radius=1, start angle=240, end angle=360];
\end{tikzpicture}

\end{document}

but this does not give the right result, and the arguments of the function are such that it's quite difficult to make what I have in mind.

Best Answer

The problem is that an arc of radius 1 from one coordinate (call it A) which starts at angle X and ends at angle Y will assume that A is at angle of X on the circumference of a circle with radius 1.

So your first arc assumes that (0,0) is at zero degrees on the circumference of a circle with radius 1. This means the centre of the circle must be at (-1,0).

But your second arc assumes that (1,0) is at 120 degrees on the circumference of a circle with radius 1. So the centre must be at (1.5,{.5*(sqrt(3))}.

Finally, your third arc assumes that (0,0) is at 240 degrees on the circumference of a circle with radius 1. So the centre must be at ({cos(60)},{sin(60)}).

[On the improbable assumption that I've not messed up the geometry at this hour of the night.]

I suggest using polar coordinates instead. Then your arcs can start at (0:1), (120:1) and (240:1) which makes things much simpler.

\documentclass[border=10pt,tikz]{standalone}
\begin{document}
\begin{tikzpicture}
  \draw [red] (0:1) arc [radius=1, start angle=0, end angle=120];
  \draw [green] (120:1) arc [radius=1, start angle=120, end angle=240];
  \draw [blue] (240:1) arc [radius=1, start angle=240, end angle=360];
\end{tikzpicture}
\end{document}

joining up <code>arc</code>s