# Colouring of intersection of four circles with TikZ

I want to selectively fill intersection of four circles as shown below.

I was able to make some of the intersections correctly but not able to figure out how to make the remaining ones.

Here is the MWE and its result.

 \documentclass[10pt]{article}
\usepackage{pgf,tikz}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}
\clip(0,0) rectangle (4.2,3);
\fill [fill=blue] (1.64,1.22) circle (1.16cm);
\fill[fill=white] (1.34,1.11) circle (0.53cm);
\fill[fill=blue](2.50,1.71) circle (1.18cm);
\fill [fill=blue](1.02,1.99) circle (0.82cm);

\clip [](1.02,1.99) circle (0.82cm);
\fill [fill=yellow]  (1.34,1.11) circle (0.53cm);

\clip [] (2.50,1.71) circle (1.18cm);
\fill [fill=green] (1.34,1.11) circle (0.53cm);

\clip [] (1.02,1.99) circle (0.82cm);
\fill [fill=white] (2.50,1.71) circle (1.18cm);

\clip [] (1.64,1.22) circle (1.16cm);
\fill [fill=red] (2.50,1.71) circle (1.18cm);

\clip [] (1.34,1.11) circle (0.53cm);
\fill [fill=white] (1.02,1.99) circle (0.82cm);

\clip [] (1.34,1.11) circle (0.53cm);
\fill [fill=black] (2.50,1.71) circle (1.18cm);
\end{tikzpicture}
\end{document}


Any other hints in drawing it more efficiently or easily would be welcome.

This fills the intersections differently. It is a bit hard to judge from the BW picture what precisely you wish to achieve, and I apologize in advance for possible misinterpretations. Note also that, if you want to apply a given clip to only some paths/fills, you need to put it in a scope. And it is arguably advantageous to store repeated paths somehow, one possibility being insert path.

\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}[my circ/.style={insert path={
\ifcase#1
\or
(1.64,1.22) circle (1.16cm)
\or
(2.50,1.71) circle (1.18cm)
\or
(1.02,1.99) circle (0.82cm)
\or
(1.34,1.11) circle (0.53cm)
\fi}}]
\clip(0,0) rectangle (4.2,3);
\fill[blue,my circ/.list={1,2,3}];
\fill[white,my circ=4];
\foreach \Y/\Z in {{1,2}/magenta,{1,3}/magenta,{1,2,3}/yellow,{1,2,4}/green,{1,3,4}/orange,
{2,3,4}/purple,{2,3}/cyan,{1,2,3}/red}
{\begin{scope}
\foreach \X in \Y
{\clip [my circ=\X];}
\fill[\Z] (0,0) rectangle (4.2,3);
\end{scope}}
\end{tikzpicture}
\end{document}


As for your clarified question: use even odd rule.

\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}[my circ/.style={insert path={
\ifcase#1
\or
(1.64,1.22) circle (1.16cm)
\or
(2.50,1.71) circle (1.18cm)
\or
(1.02,1.99) circle (0.82cm)
\or
(1.34,1.11) circle (0.53cm)
\fi}}]
\fill[even odd rule,my circ/.list={1,2,3,4}];
\end{tikzpicture}
\end{document}


• the colours were just to indicate the regions they would produce on clipping, more like markers sorry if they caused any confusion. finally, with the scoping different clips, I was able to create the required image as shown in my answer below. Though it is not an elegant solution it works. – Damitr Mar 15 at 17:20
• @Damitr Fair enough. I added a version of my answer that does that in an arguably more elegant way. – marmot Mar 15 at 17:40
• Yes, much more elegant, thanks! – Damitr Mar 15 at 17:43

Looking at the hint posted by @Raaja I found that not using scope was causing the clips not render. With scope for every clip, I was able to achieve required construction. Though the solution is not elegant or efficient, perhaps it can be made easier/better. Here it goes.

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\path
(1.64,1.22) coordinate (C)
(1.34,1.11) coordinate (A)
(2.50,1.71) coordinate (B)
(1.02,1.99) coordinate (D);
\fill [fill=black](B) circle (1.18cm);
\fill [fill=black](C) circle (1.16cm);
\fill [fill=white](A) circle (0.53cm);
\fill [fill=black](D) circle (0.82cm);

\begin{scope}
\draw[clip] (B) circle (1.18cm);
\fill[white] (C) circle (1.16cm);
\end{scope}

\begin{scope}
\draw[clip] (A) circle (0.53cm);
\fill[black] (B) circle (1.18cm);
\end{scope}

\begin{scope}%top white corner
\draw[clip] (D) circle (0.82cm);
\fill[white] (B) circle (1.18cm);
\end{scope}

\begin{scope}
\draw[clip] (D) circle (0.82cm);
\fill[white] (C) circle (1.16cm);
\end{scope}

\begin{scope}
\draw[clip] (A) circle (0.53cm);
\fill [black] (D) circle (0.82cm);
\end{scope}

\begin{scope}%
\draw[clip] (B) circle (1.18cm);
\draw[clip] (C) circle (1.16cm);
\fill[black] (D) circle (0.82cm);
\end{scope}

\begin{scope}% centre white triangle
\draw[clip] (B) circle (1.18cm);
\draw[clip] (C) circle (1.16cm);
\draw[clip] (A) circle (0.53cm);
\fill[white] (D) circle (0.82cm);
\end{scope}
\end{tikzpicture}
\end{document}


Though using any other colour than black, produces an image with black outline which I am not able to remove. Using any option with clip seems to be not allowed.