LabCanvas

Venn diagram in TikZ with transparency, explained

Quick answer

This figure is a three-set Venn diagram: red, green and blue circles labelled Designing, Drawing and Coding overlap around the word TikZ. It takes eight lines: one \filldraw per circle at polar coordinates 120° apart, one node per label, and two picture options doing the work, fill opacity=0.4, which makes every fill translucent so the overlaps mix their colours, and text opacity=1, which keeps the text solid. The variations shade set operations with \clip and the even odd rule, and put a count in each of the seven regions.

Contents

The figure and its code

A Venn diagram of three overlapping translucent circles, red at the top labelled Designing, green at the lower left labelled Drawing and blue at the lower right labelled Coding, with darker mixed colours where they overlap and the word TikZ in large type at the centre.
Venn diagram with transparency, typeset with TeX Live 2026 (pdfLaTeX) from the code below, exactly as it is in PacktPublishing/LaTeX-graphics-with-TikZ.
Copyright (c) 2022 Packt · MIT licence (full text). The licence asks that this notice stay with the code: keep the first lines when you reuse it.
% Venn diagram with transparency
% Source: https://github.com/PacktPublishing/LaTeX-graphics-with-TikZ/blob/82e099639f46ee92bc622a01c739e7f7a3e87f4b/09-using-layers/04-fill-text-opacity.tex
% Copyright (c) 2022 Packt. MIT licence: https://github.com/PacktPublishing/LaTeX-graphics-with-TikZ/blob/main/LICENSE
% The licence’s copyright and permission notice: https://www.labcanvas.com/tikz-library/credits.html
\documentclass[tikz,border=10pt]{standalone}
\begin{document}
\begin{tikzpicture}[very thick, fill opacity=0.4, text opacity=1]
  \filldraw[red]   ( 90:1.2) circle (2);
  \filldraw[green] (210:1.2) circle (2);
  \filldraw[blue]  (330:1.2) circle (2);
  \node at ( 90:2)    {Designing};
  \node at (210:2)    {Drawing};
  \node at (330:2)    {Coding};
  \node [font=\LARGE] {TikZ};
\end{tikzpicture}
\end{document}

A standalone page with TikZ

Lines 5–6 of the code

\documentclass[tikz,border=10pt]{standalone} loads TikZ through the class option and leaves 10pt of white space around the picture. No library is needed: circles, fills and opacity are all part of TikZ itself. (Older PostScript-based workflows needed a recent Ghostscript for transparency, as the manual notes; with pdfLaTeX it simply works.)

Three options for the whole picture

Line 7 of the code

The tikzpicture options apply to everything inside. very thick sets the outline width. fill opacity=0.4 makes every filling 40% opaque, so where two circles overlap the second one tints the first instead of hiding it, and where all three overlap the colour is darkest. The manual points out that fill opacity also applies to text, which would leave the labels faded; text opacity=1 overrides it for text only. The outlines are not affected, because the opacity of lines is a separate key, draw opacity, left at 1.

Three circles at polar coordinates

Lines 8–10 of the code

\filldraw[red] ( 90:1.2) circle (2); fills and outlines a circle of radius 2 centred at the polar coordinate (90°, 1.2): straight up, 1.2 cm from the origin. The other two are at 210° and 330°, so the three centres form an equilateral triangle around the origin and the overlaps are symmetric. A single colour name such as red sets both the fill and the outline colour. The spaces inside ( 90:1.2) only line the three lines up; TikZ ignores them.

With normal transparency the order of drawing still shows: each circle is composited over the ones before it, so the blue circle, drawn last, tints the overlaps slightly more than the red one, and its outline crosses over theirs.

Labels in the single-set regions

Lines 11–14 of the code

Each label is a node at the same angle as its circle but further out, \node at ( 90:2) {Designing};: 2 cm from the origin is 0.8 cm beyond the circle’s centre, inside its own circle but outside the other two, in the part that belongs to that set alone. Reusing the angle keeps each label lined up with the centre of its own circle, so moving a circle means changing one angle in two places. \node [font=\LARGE] {TikZ}; has no position, so it sits at the origin, in the region shared by all three. Thanks to text opacity=1 all four labels are fully black, even though fill opacity is in force.

Techniques used

Variations

Our own code, written for this page and typeset with TeX Live 2026 like the figure above. Each one is a complete example: copy it, or open it in the TikZ editor and change it. This code is CC0 1.0, free to use without conditions.

Intersection, union, symmetric difference and difference

For set theory you shade a region rather than tint whole circles. With both sets stored as macros (\def\A{(-0.6,0) circle[radius=1]}), the intersection is \clip \A; \fill \B; inside a scope; the union fills both circles in one path; the symmetric difference fills them with even odd rule, which leaves the doubly covered overlap empty; and the difference is that same fill clipped to A.

Four pairs of overlapping circles labelled A and B: in the first only the overlap is orange (A ∩ B), in the second both circles are orange (A ∪ B), in the third both are orange except the overlap (A △ B), and in the fourth only the part of A outside B is orange (A ∖ B).
A ∩ B, A ∪ B, A △ B and A ∖ B shaded with \clip and the even odd rule
Preamble: \usepackage{tikz}
\begin{tikzpicture}[thick]
  % the two sets as macros, so every panel uses exactly the same circles
  \def\A{(-0.6,0) circle[radius=1]}
  \def\B{(0.6,0) circle[radius=1]}
  \def\labels{\node at (-1.3,0.95) {$A$}; \node at (1.3,0.95) {$B$};}
  % intersection: clip to A, then fill B
  \begin{scope}
    \begin{scope} \clip \A; \fill[orange!60] \B; \end{scope}
    \draw \A \B; \labels
    \node at (0,-1.45) {$A \cap B$};
  \end{scope}
  % union: fill both
  \begin{scope}[xshift=3.5cm]
    \fill[orange!60] \A \B;
    \draw \A \B; \labels
    \node at (0,-1.45) {$A \cup B$};
  \end{scope}
  % symmetric difference: the even odd rule leaves the overlap empty
  \begin{scope}[xshift=7cm]
    \fill[orange!60, even odd rule] \A \B;
    \draw \A \B; \labels
    \node at (0,-1.45) {$A \mathbin{\triangle} B$};
  \end{scope}
  % difference: the same fill, clipped to A
  \begin{scope}[xshift=10.5cm]
    \begin{scope} \clip \A; \fill[orange!60, even odd rule] \A \B; \end{scope}
    \draw \A \B; \labels
    \node at (0,-1.45) {$A \setminus B$};
  \end{scope}
\end{tikzpicture}
Open in the TikZ editor
Full document
A complete file you can compile as it is.
\documentclass[border=4pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[thick]
  % the two sets as macros, so every panel uses exactly the same circles
  \def\A{(-0.6,0) circle[radius=1]}
  \def\B{(0.6,0) circle[radius=1]}
  \def\labels{\node at (-1.3,0.95) {$A$}; \node at (1.3,0.95) {$B$};}
  % intersection: clip to A, then fill B
  \begin{scope}
    \begin{scope} \clip \A; \fill[orange!60] \B; \end{scope}
    \draw \A \B; \labels
    \node at (0,-1.45) {$A \cap B$};
  \end{scope}
  % union: fill both
  \begin{scope}[xshift=3.5cm]
    \fill[orange!60] \A \B;
    \draw \A \B; \labels
    \node at (0,-1.45) {$A \cup B$};
  \end{scope}
  % symmetric difference: the even odd rule leaves the overlap empty
  \begin{scope}[xshift=7cm]
    \fill[orange!60, even odd rule] \A \B;
    \draw \A \B; \labels
    \node at (0,-1.45) {$A \mathbin{\triangle} B$};
  \end{scope}
  % difference: the same fill, clipped to A
  \begin{scope}[xshift=10.5cm]
    \begin{scope} \clip \A; \fill[orange!60, even odd rule] \A \B; \end{scope}
    \draw \A \B; \labels
    \node at (0,-1.45) {$A \setminus B$};
  \end{scope}
\end{tikzpicture}
\end{document}

A count in each of the seven regions

The same geometry as the original, with a number in every region. One \foreach draws the circles and their titles from (angle, colour, name, position) tuples. The counts are placed with polar coordinates too: the single-set regions lie along the circles’ own directions (90°, 210°, 330°) at 2.15 cm, the two-set regions along the directions between them (30°, 150°, 270°) at 1.35 cm, and the three-set region at the origin.

Three translucent circles titled Physics (red, top), Chemistry (green, lower left) and Biology (blue, lower right), with the counts 12, 9 and 15 in the single regions, 4, 6 and 5 in the pairwise overlaps and a bold 3 in the centre.
a three-set Venn diagram with a count in each region, all placed with polar coordinates
Preamble: \usepackage{tikz}
\begin{tikzpicture}[thick, fill opacity=0.25, text opacity=1, font=\sffamily]
  % three circles 120 degrees apart, each with its title just outside it
  \foreach \ang/\col/\name/\pos in {90/red/Physics/above, 210/green!50!black/Chemistry/below left,
                                    330/blue/Biology/below right} {
    \filldraw[\col] (\ang:1.2) circle[radius=2];
    \node[\pos, text=\col] at (\ang:3.2) {\name};
  }
  % one count per region, placed along the directions of the circles and between them
  \foreach \ang/\n in {90/12, 210/9, 330/15} \node at (\ang:2.15) {\n};
  \foreach \ang/\n in {150/4, 270/6, 30/5} \node at (\ang:1.35) {\n};
  \node[font=\sffamily\bfseries] at (0,0) {3};
\end{tikzpicture}
Open in the TikZ editor
Full document
A complete file you can compile as it is.
\documentclass[border=4pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[thick, fill opacity=0.25, text opacity=1, font=\sffamily]
  % three circles 120 degrees apart, each with its title just outside it
  \foreach \ang/\col/\name/\pos in {90/red/Physics/above, 210/green!50!black/Chemistry/below left,
                                    330/blue/Biology/below right} {
    \filldraw[\col] (\ang:1.2) circle[radius=2];
    \node[\pos, text=\col] at (\ang:3.2) {\name};
  }
  % one count per region, placed along the directions of the circles and between them
  \foreach \ang/\n in {90/12, 210/9, 330/15} \node at (\ang:2.15) {\n};
  \foreach \ang/\n in {150/4, 270/6, 30/5} \node at (\ang:1.35) {\n};
  \node[font=\sffamily\bfseries] at (0,0) {3};
\end{tikzpicture}
\end{document}

Frequently asked questions

How do I draw a Venn diagram in TikZ?

Draw the circles with \filldraw at positions such as (90:1.2), (210:1.2) and (330:1.2) and set fill opacity=0.4 on the picture so the overlaps show through; add text opacity=1 so the labels stay solid. The whole figure on this page is eight lines.

How do I shade only the intersection of two circles?

Clip to one circle and fill the other inside a scope: \begin{scope} \clip (0,0) circle[radius=1]; \fill[orange] (1,0) circle[radius=1]; \end{scope}. Then draw the outlines on top.

Why is the text in my Venn diagram faded?

fill opacity also applies to text and images. Add text opacity=1 to the picture or to the node to keep the text fully opaque.

References

  1. PacktPublishing/LaTeX-graphics-with-TikZ at commit 82e0996: 09-using-layers/04-fill-text-opacity.tex (MIT licence)github.com
  2. PGF/TikZ manual, §23.2 Specifying a Uniform Opacity (fill opacity, text opacity)tikz.dev
  3. PGF/TikZ manual, §13.2.1 Canvas, XYZ, and Polar Coordinate Systemstikz.dev
  4. PGF/TikZ manual, §14.6 The Circle and Ellipse Operationstikz.dev
  5. PGF/TikZ manual, §15.5 Filling a Path (fill, filldraw, interior rules)tikz.dev
  6. PGF/TikZ manual, §15.9 Clipping and Fading (Soft Clipping)tikz.dev

The walkthrough was checked against these sources and the pictures are the code typeset with TeX Live 2026. The original figure is © Packt (code from LaTeX Graphics with TikZ by Stefan Kottwitz), under the MIT licence; the variations on this page are ours, CC0 1.0.

TikZ guides for these techniques

More figures explained

Change this figure in your browserOpen the figure or any variation in the free TikZ editor: it is typeset with TeX Live as you type, with errors pointed at their line.

Open the figure in the TikZ editor