Venn Diagram

📅 April 07, 2024   |   👁️ Views: 165





\documentclass{standalone}
\standaloneconfig{border=2mm 2mm 2mm 2mm}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{document}
\begin{tikzpicture}

% Define the circles
\def\firstcircle{(0,0) circle (2cm)}
\def\secondcircle{(60:2cm) circle (2cm)}
\def\thirdcircle{(0:2cm) circle (2cm)}

% Draw the rectangle
\draw[dashed] (-3,-2.5) rectangle (4.5,4.5) node at (-2.5,4) {$E$};

% Draw the circles
\draw \firstcircle;
\draw \secondcircle;
\draw \thirdcircle;

% Fill the intersections
\begin{scope}
  \clip \firstcircle;
  \fill[red,opacity=0.5] \secondcircle;
\end{scope}

\begin{scope}
  \clip \firstcircle;
  \fill[green,opacity=0.5] \thirdcircle;
\end{scope}

\begin{scope}
  \clip \secondcircle;
  \fill[blue,opacity=0.5] \thirdcircle;
\end{scope}


% Add the labels
\draw (-2.5,0) node at (-1,-1) {$A$};
\draw (1,2.5) node[above] {$B$};
\draw (1,-2.5) node at (2.5,-1) {$C$};
\draw (-0.1,1.4) node[rotate=20] {$A \cap B \setminus C$};
\draw (1.3,1.5) node[rotate=20] {$B \cap C$};
\draw (0.6,-0.3) node[rotate=45] {$A \cap C$};
\draw (1,0.5) node {$A \cap B \cap C$};

\end{tikzpicture}

\end{document}



\documentclass{standalone}
\standaloneconfig{border=2mm 2mm 2mm 2mm}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{document}
\begin{tikzpicture}

% Define the circles
\def\firstcircle{(0,0) circle (2cm)}
\def\secondcircle{(60:2cm) circle (2cm)}
\def\thirdcircle{(0:2cm) circle (2cm)}

% Draw the rectangle
\draw[dashed] (-3,-2.5) rectangle (4.5,4.5) node at (-2.5,4) {$E$};

% Draw the circles
\draw \firstcircle;
\draw \secondcircle;
\draw \thirdcircle;

% Fill the intersections
\begin{scope}
  \clip \firstcircle;
  \fill[red,opacity=0.5] \secondcircle;
\end{scope}

\begin{scope}
  \clip \firstcircle;
  \fill[green,opacity=0.5] \thirdcircle;
\end{scope}

\begin{scope}
  \clip \secondcircle;
  \fill[blue,opacity=0.5] \thirdcircle;
\end{scope}


% Add the labels
\draw (-2.5,0) node at (-1,-1) {$A$};
\draw (1,2.5) node[above] {$B$};
\draw (1,-2.5) node at (2.5,-1) {$C$};
\draw (-0.1,1.4) node[rotate=20] {$A \cap B \setminus C$};
\draw (1.3,1.5) node[rotate=20] {$B \cap C$};
\draw (0.6,-0.3) node[rotate=45] {$A \cap C$};
\draw (1,0.5) node {$A \cap B \cap C$};

\end{tikzpicture}

\end{document}



Related Courses, Exams, and Exercises


Course PDF:

📥 Download Venn Diagram (PDF)

if you find this content helpful, Please consider supporting me with a small donation
إن وجدت هذا المحتوى مفيدا، من فضلك إدعمني بمبلغ بسيط كتبرع

Buy me a coffee — إشتر لي قهوة

PayPal.me • عبر بايبال

Or bank transfer • أو حوالة بنكية

Titulaire : RADOUAN MOSAID
RIB : 230 090 6501953211022000 65
IBAN : MA64 2300 9065 0195 3211 0220 0065
BIC / SWIFT : CIHMMAMC

QR Code for Bank Transfer