两组维恩图,用于并集、交集和补集

两组维恩图,用于并集、交集和补集

我花了一段时间才弄清楚如何绘制以下两组维恩图。所以我在这里发布代码,希望它能让某些人高兴。

\documentclass{article}
\usepackage{tikz}
\usepackage{caption}

\definecolor{airforceblue}{rgb}{0.36, 0.54, 0.66}
\definecolor{brightgreen}{rgb}{0.4, 1.0, 0.0}

\begin{document}

\begin{tikzpicture}
 
% Set J
\node [circle,
    fill=airforceblue,
        draw=orange,
        line width=2mm,
    minimum size =3cm,
    label={[label distance=0.1cm,orange,font=\Large]225:$J$}] (J) at (0,0){};

% Set K
\node [circle,
    fill=airforceblue,
        draw=brightgreen,
        line width=2mm,
    minimum size =3cm,
    label={[label distance=0.1cm,brightgreen,font=\Large]45:$K$}] (K) at (1.8,0){};
 
% Circles outline
\draw[orange,thick] (0,0) circle(1.5cm);
\draw[white,thick] (1.8,0) circle(1.5cm);
 
% Union text label
\node[airforceblue!90!black] at (0.9,1.8) {$J\cup K$};

% Intersection text label
\node at (0.9,0) {$J\cap K$};

% Complements text label
\node[left,white] at (J.center){$J \setminus K$};
\node[right,white] at (K.center){$K \setminus J$};
 
\end{tikzpicture}
%\captionof{figure}{Venn diagramms for union, intersection and complement}

\end{document}

我使用来自的初始代码这里并使其个性化。

相关内容