# Area diagrams in Tikz

Introduction:

I'm currently doing some research in the field of continuum percolation, and I need to create relevant diagrams according to the following specifications:

1. The diagram consists of three circles of shown separation distances and radii.
2. When the circles overlap, I'd like the intersecting areas to be highlighted.

This is what I'd like to make, but it'd be better if the two halves of the orange region were also labelled (and green region). L1 and L2 are the separation distances. The C's are just labels. The r's are the radii.

Motivation:

I've derived equations of the total area for a 3-circle system given the parameters mentioned above. The derivation utilizes constructs like overlapping areas as well as those parameters.

Problem:

I have very little direction on where to begin to render these diagrams. I know Tikz is the starting point.

Question:

What specific constructs within Tikz can help me render the diagrams adhering to the specifications above? Any guidance is greatly appreciated.

• I'm not sure what these diagrams would even look like. Could you post an image: even a hand-drawn image would be helpful for us to give guidance with. – A.Ellett Jan 25 '16 at 21:56
• @A.Ellett I updated the original post with a picture of what would be ideal. – Jeesubmyunu Jan 26 '16 at 3:46

Taking some liberties (as pointed out in the comments, we don't know exactly what you are after) here is a quick implementation. The centers and radii of the circles are declared as commands and then the \clip command is used to build the intersecting regions, which are filled.

\documentclass{article}
\usepackage{tikz}

\newcommand{\circleA}{(0cm,0cm) circle (1cm)}
\newcommand{\circleB}{(3cm,3cm) circle (4cm)}
\newcommand{\circleC}{(-1cm,1cm) circle (2cm)}
\begin{document}
\begin{tikzpicture}
\begin{scope}%fill for AB
\clip\circleA;
\fill[red] \circleB;
\end{scope}
\begin{scope}%fill for AC
\clip\circleA;
\fill[yellow]\circleC;
\end{scope}
\begin{scope}%fill for BC
\clip \circleB;
\fill[green] \circleC;
\end{scope}
\begin{scope}%fill for ABC
\clip \circleA;
\clip \circleB;
\fill[blue] \circleC;
\end{scope}
\draw \circleA;
\draw \circleB;
\draw \circleC;
\end{tikzpicture}
\end{document}


• This is a great start. I would just need to add radii, separation distances, and labels. I updated the original post with a picture of what would be ideal. – Jeesubmyunu Jan 26 '16 at 3:46

Just to point out an alternative to "I know Tikz is the starting point." Here is an approach using Metapost as part of LuaLaTeX and the luamplib package. Compile with lualatex.

\documentclass[border=5mm]{standalone}
\usepackage{fontspec}
\usepackage{luamplib}
\setmainfont{Helvetica Neue}
\begin{document}
\mplibtextextlabel{enable} % this allows plain labels to use LaTeX fonts
\begin{mplibcode}
beginfig(1);
% define three circles
path C[];
C1 = fullcircle scaled 100 rotated 90;
C2 = fullcircle scaled 100 shifted 89 down;
C3 = fullcircle scaled  64 rotated 90 shifted 64 right;

% colour the overlaps
fill buildcycle(C1, C3) withcolor red+1/2green;
fill buildcycle(C1, C2) withcolor 1/2red+green;

% draw the separations
draw center C1 -- center C2 withcolor 1/2 green;
draw center C1 -- center C3 withcolor 1/2 green;

% draw radius, circumference and mark centre, for each circle
forsuffixes $=1,2,3: draw center C$ -- point 0 of C$withcolor red; draw C$           withpen pencircle scaled 3;
drawdot center C\$ withpen pencircle scaled 4;
endfor

label("C1", 1/2[center C1, point 1.5 of C1]);
label("C2", 1/2[center C2, point 6   of C2]);
label("C3", 1/2[center C3, point 6   of C3]);

label.rt ("r1",2/3[center C1, point 0 of C1]) withcolor 2/3 red;
label.top("r2",2/3[center C2, point 0 of C2]) withcolor 2/3 red;
label.rt ("r3",2/3[center C3, point 0 of C3]) withcolor 2/3 red;

label.top("L1", 1/4[center C1, center C3]) withcolor 1/3 green;
label.lft("L2", 1/4[center C1, center C2]) withcolor 1/3 green;

endfig;
\end{mplibcode}
\end{document}