Documentation/TikZ & Graphics/How to Draw a Venn Diagram in TikZ
TikZ & Graphics

How to Draw a Venn Diagram in TikZ

Venn diagrams are used throughout mathematics, probability, logic, and data science to visualize set relationships. TikZ makes it easy to draw professional Venn diagrams with precisely controlled overlaps, shading, and labels. This tutorial covers two-set, three-set, and custom Venn diagrams with filled intersections. Bibby AI's live preview lets you adjust circle positions and colors in real time — ideal for getting the overlap just right without repeated recompilation.

Draw a Basic Two-Set Venn Diagram

Create two overlapping circles with labels for each set and the intersection region:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
    % Define circle positions and radius
    \def\circleA{(0,0) circle (1.5cm)}
    \def\circleB{(2,0) circle (1.5cm)}

    % Fill intersection (A AND B)
    \begin{scope}
        \clip \circleA;
        \fill[yellow!50] \circleB;
    \end{scope}

    % Draw circles
    \draw \circleA node[left=1cm] {$A$};
    \draw \circleB node[right=1cm] {$B$};

    % Label the intersection
    \node at (1,0) {$A \cap B$};

    % Bounding rectangle (optional)
    \draw (-2.5,-2) rectangle (4.5,2) node[below left] {$U$};
\end{tikzpicture}
\end{document}

Draw a Three-Set Venn Diagram with All Regions Labeled

Create a three-circle Venn diagram with shaded regions and labels for all seven distinct areas:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
    \def\circA{(90:1.2) circle (2cm)}
    \def\circB{(210:1.2) circle (2cm)}
    \def\circC{(330:1.2) circle (2cm)}

    % Shade A ∩ B ∩ C (center intersection)
    \begin{scope}
        \clip \circA;
        \clip \circB;
        \fill[red!30] \circC;
    \end{scope}

    % Shade A ∩ B only (excluding C)
    \begin{scope}
        \clip \circA;
        \clip \circB;
        \fill[blue!20] \circB;  % Fills A∩B
    \end{scope}
    % Re-shade center
    \begin{scope}
        \clip \circA; \clip \circB;
        \fill[red!30] \circC;
    \end{scope}

    % Draw all circles
    \draw \circA node[above=1.8cm] {$A$};
    \draw \circB node[below left=1.5cm] {$B$};
    \draw \circC node[below right=1.5cm] {$C$};

    % Label regions
    \node at (90:2) {$A$};
    \node at (210:2) {$B$};
    \node at (330:2) {$C$};
    \node at (0,0) {\scriptsize$A{\cap}B{\cap}C$};

    % Universe
    \draw (-4,-3.5) rectangle (4,3.5) node[below left] {$U$};
\end{tikzpicture}
\end{document}

Create a Styled Venn Diagram with Transparency

Use fill opacity for modern overlapping colors without clipping complexity:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
    % Semi-transparent fills create natural intersection colors
    \fill[red!40, fill opacity=0.5]   (0,0) circle (2cm);
    \fill[blue!40, fill opacity=0.5]  (2.5,0) circle (2cm);
    \fill[green!40, fill opacity=0.5] (1.25,2) circle (2cm);

    % Circle outlines
    \draw[thick] (0,0) circle (2cm);
    \draw[thick] (2.5,0) circle (2cm);
    \draw[thick] (1.25,2) circle (2cm);

    % Set labels
    \node[font=\large\bfseries] at (-1.2,0) {Physics};
    \node[font=\large\bfseries] at (3.7,0) {Math};
    \node[font=\large\bfseries] at (1.25,3.2) {CS};

    % Intersection labels
    \node[font=\small] at (1.25,0) {Modeling};
    \node[font=\small] at (0.3,1.2) {HPC};
    \node[font=\small] at (2.2,1.2) {Algorithms};
    \node[font=\scriptsize] at (1.25,0.7) {ML};
\end{tikzpicture}
\end{document}

💡 Tips

  • Use fill opacity for quick Venn diagrams — overlapping translucent fills automatically show intersections in blended colors.
  • For precise control of individual intersection regions, use the \clip-then-\fill technique shown in the two-set example.
  • Position three circles at 120° intervals using polar coordinates (90:r), (210:r), (330:r) for symmetric layouts.
  • Add \usepackage{amsmath} if you want to use \cap, \cup, and other set notation symbols in labels.

Try This in Bibby AI

Write LaTeX faster with AI auto-complete and instant compilation.

Start Writing Free

Related Tutorials

How to Draw a Venn Diagram in TikZ | Bibby AI