# Draw circle with three colours in tikz

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:

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.

• Welcome to TeX.se. Please don't post code fragments. Instead put your code into a complete compilable document that people can play with. May 8 '17 at 14:20
• Sorry! Fixed it now, let me know if there's something else to fix. May 8 '17 at 14:23
• What do you have in mind exactly? We know what it isn't, but what is it? What do you mean by a line?
– cfr
May 8 '17 at 22:32
• I actually had no precise idea of what I meant by "line" except for "something thinner than the picture". All of the answers below work well for what I need to do! May 9 '17 at 8:30

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} • +1 for the explanation and for having read the question carefully! May 9 '17 at 5:02

I am posting this code, which is from a deleted answer by Zarko on a related question (TikZ: Circle with color transition). It is not my code, so I've made the answer Community Wiki.

\documentclass[border=5mm,tikz]{standalone}

\begin{document}
\foreach \i [count=\ii from 0] in {red, green, blue}
\fill[\i] (0,0) -- (\ii*120:32mm)
arc[start angle=\ii*120,delta angle=120]
-- cycle;
\fill[white] (0,0) circle (16mm);
\end{tikzpicture}
\end{document} To add the white space between the parts, you can use \fill[\i, draw=white, very thick]. To make the bars thinner, adjust the size of white circle in the middle.

Edit:

Of course, if you need only a line, you may increase the radius of the white internal circle, for example:

\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}
\tkzDefPoint(0,0){O}
\fill[white] (0,0) circle (.95); % <--- here put the value you like
\end{tikzpicture}
\end{document} You could also use tkz-euclide package:

\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}
\tkzDefPoint(0,0){O} • @MCMastery Thank you! Indeed, I put the gaps because they were in the original image. However, you may also easily avoid them, it's enough to write \draw=mycolor instead of \draw=white. May 9 '17 at 4:16