How to draw intersecting circles that are white and have colored numbers in them using TikZ?

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{tikz}
\title{FUN A3}
\author{12356}
\date{December 2017}
\setlength{\parindent}{0pt}
\begin{document}

\begin{tikzpicture}
 \tikzset{venn circle/.style={draw,circle,minimum 
 width=5.5cm}}

\node [venn circle, label={[fill=yellow]center:0}] (A) at (0,0) {};
\node [venn circle, label={[fill=yellow]center:1}] (B) at (60:4cm) {};
\node [venn circle, label={[fill=yellow]center:1}] (C) at (0:4cm) {};
\node[fill=yellow] at (barycentric cs:A=1/2,B=1/2 ) {1}; 
\node[fill=yellow] at (barycentric cs:A=1/2,C=1/2 ) {1};   
\node[fill=yellow] at (barycentric cs:B=1/2,C=1/2 ) {0};   
\node[fill=yellow] at (barycentric cs:A=1/3,B=1/3,C=1/3 ){0};
\end{tikzpicture}  
\end{document}

enter image description here


Just for fun ...

\documentclass[pstricks,border=1cm]{standalone}
\usepackage{auto-pst-pdf}
\begin{document}
\begin{pspicture}(-3,-3)(3,3)
\pgfforeach \iA/\iB in{90/3,210/2,330/1}{%
    \pscircle(1.2;\iA){2}%
    \rput(2;\iA){\colorbox{green!50}{$S_\iB$}}%
    \rput(!1.5 \iA\space 180 add PtoC){\colorbox{yellow}{$S_\iB$}}%
}
\rput(0,0){\colorbox{yellow}{$S_4$}}
\end{pspicture}
\end{document}

enter image description here


A PSTricks solution for emergency purpose.

\documentclass[pstricks,border=1cm]{standalone}
\begin{document}
\begin{pspicture}(-3,-3)(3,3)
    \pscircle(1.2;90){2}
    \pscircle(1.2;210){2}
    \pscircle(1.2;330){2}
    \psset{linestyle=none,fillstyle=solid}
    \psset{fillcolor=yellow}
    \rput(0,0){\psframebox{$S_4$}}
    \rput(1.5;150){\psframebox{$S_1$}}
    \rput(1.5;270){\psframebox{$S_3$}}
    \rput(1.5;30){\psframebox{$S_2$}}
    \psset{fillcolor=green!50}
    \rput(2;90){\psframebox{$S_3$}}
    \rput(2;210){\psframebox{$S_2$}}
    \rput(2;330){\psframebox{$S_1$}}
\end{pspicture}
\end{document}

enter image description here

Tags:

Circles