![两组维恩图,用于并集、交集和补集](https://linux22.com/image/446124/%E4%B8%A4%E7%BB%84%E7%BB%B4%E6%81%A9%E5%9B%BE%EF%BC%8C%E7%94%A8%E4%BA%8E%E5%B9%B6%E9%9B%86%E3%80%81%E4%BA%A4%E9%9B%86%E5%92%8C%E8%A1%A5%E9%9B%86.png)
我花了一段时间才弄清楚如何绘制以下两组维恩图。所以我在这里发布代码,希望它能让某些人高兴。
\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}
我使用来自的初始代码这里并使其个性化。