# Venn diagram in TikZ with transparency, explained

> How a three-circle Venn diagram is drawn in TikZ with fill opacity, text opacity and polar coordinates, plus set-operation and count variations.

URL: https://www.labcanvas.com/tikz/examples/diagrams/venn-diagram-with-transparency

Updated 2026-11-22. Original figure: Venn diagram with transparency, © Packt (code from LaTeX Graphics with TikZ by Stefan Kottwitz), MIT licence (licence text: https://www.labcanvas.com/tikz-library/credits.html#packt), from https://github.com/PacktPublishing/LaTeX-graphics-with-TikZ/blob/82e099639f46ee92bc622a01c739e7f7a3e87f4b/09-using-layers/04-fill-text-opacity.tex. Walkthrough and variations by LabCanvas; the variation code is CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/). Pictures typeset with TeX Live 2026 and PGF 3.1.12. Category: [TikZ diagram examples: flowcharts, mind maps, Venn](https://www.labcanvas.com/tikz/examples/diagrams).

## 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.

## 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.](https://www.labcanvas.com/tikz-snippets/fig-venn-diagram-with-transparency/original.webp)

Copyright (c) 2022 Packt, MIT licence (https://www.labcanvas.com/tikz-library/credits.html#packt). The code below is exactly the library's file (pdfLaTeX); its first lines name the source and the licence, and the MIT licence asks that they stay with the code. Open it in the TikZ editor from the page: https://www.labcanvas.com/tikz/examples/diagrams/venn-diagram-with-transparency

```latex
% 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

- [Opacity: fill opacity and text opacity](https://www.labcanvas.com/tikz/colors): translucent fills that mix where they overlap, with the text kept solid.
- [Polar coordinates](https://www.labcanvas.com/tikz/coordinates): `( 90:1.2)`, `(210:1.2)`, `(330:1.2)` place the circles 120° apart.
- [Circles and filled paths](https://www.labcanvas.com/tikz/circles-arcs): `\filldraw[red] … circle (2)` fills and strokes in one command.
- [Diagrams](https://www.labcanvas.com/tikz/diagrams): Venn diagrams among the other diagram types you can draw with TikZ.

## Variations

Our own code, CC0 1.0, each typeset with TeX Live 2026 in a standalone document with the preamble lines shown.

### 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).](https://www.labcanvas.com/tikz-snippets/fig-venn-diagram-with-transparency/set-operations.webp)

*A ∩ B, A ∪ B, A △ B and A ∖ B shaded with \clip and the even odd rule*

Preamble: `\usepackage{tikz}`

```latex
\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}
```

### 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.](https://www.labcanvas.com/tikz-snippets/fig-venn-diagram-with-transparency/region-counts.webp)

*a three-set Venn diagram with a count in each region, all placed with polar coordinates*

Preamble: `\usepackage{tikz}`

```latex
\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}
```

## 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

- [PacktPublishing/LaTeX-graphics-with-TikZ at commit 82e0996: 09-using-layers/04-fill-text-opacity.tex (MIT licence)](https://github.com/PacktPublishing/LaTeX-graphics-with-TikZ/blob/82e099639f46ee92bc622a01c739e7f7a3e87f4b/09-using-layers/04-fill-text-opacity.tex)
- [PGF/TikZ manual, §23.2 Specifying a Uniform Opacity (fill opacity, text opacity)](https://tikz.dev/tikz-transparency#sec-23.2)
- [PGF/TikZ manual, §13.2.1 Canvas, XYZ, and Polar Coordinate Systems](https://tikz.dev/tikz-coordinates#sec-13.2.1)
- [PGF/TikZ manual, §14.6 The Circle and Ellipse Operations](https://tikz.dev/tikz-paths#sec-14.6)
- [PGF/TikZ manual, §15.5 Filling a Path (fill, filldraw, interior rules)](https://tikz.dev/tikz-actions#sec-15.5)
- [PGF/TikZ manual, §15.9 Clipping and Fading (Soft Clipping)](https://tikz.dev/tikz-actions#sec-15.9)

## TikZ guides for these techniques

- [TikZ colors: names, mixing, fill, shading and patterns](https://www.labcanvas.com/tikz/colors): TikZ colours with xcolor: every named colour (base and dvipsnames charts), red!30 mixing, custom colours, fill and filldraw, opacity, shading, patterns.
- [How to draw circles, ellipses and arcs in TikZ](https://www.labcanvas.com/tikz/circles-arcs): Draw circles, ellipses and arcs in TikZ: circle[radius], ellipse radii, arc start/end angle and centre, half circles, sectors, pie charts and angle marks.
- [TikZ diagrams: block, cycle, flowchart, tree and more](https://www.labcanvas.com/tikz/diagrams): How to draw diagrams in TikZ: block, cycle, flowchart, tree, graph, timeline, matrix, commutative and circuit diagrams, each with compiled code.
- [TikZ coordinates, paths, \foreach, scopes and styles](https://www.labcanvas.com/tikz/coordinates): TikZ coordinates (polar, relative ++, named, calc, intersections), paths and controls, \foreach loops, scopes, \tikzset styles, decorations and grids.
