我可以生成以下内容,但需要修改它以包含圆 A 和 B - C 交点的阴影。有什么建议吗?
\documentclass[border=0.2cm]{standalone}
% Required packages
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[thick,
set/.style = {circle,
minimum size = 3cm,
fill=black!30}]
% Set A
\node[set,label={135:$A$}] (A) at (0,0) {};
% Set B
\node[set,fill=white, label={45:$B$}] (B) at (1.8,0) {};
% Set C
\node[set,label=$C$] (C) at (0.9,1.5) {};
% Intersection
\begin{scope}
\clip (0,0) circle(1.5cm);
\clip (1.8,0) circle(1.5cm);
\clip (0.9,1.5) circle(1.5cm);
\fill[white!60](1.8,0) circle(1.5cm);
\end{scope}
% Circles outline
\draw (0,0) circle(1.5cm);
\draw (1.8,0) circle(1.5cm);
\draw (0.9,1.5) circle(1.5cm);
\end{tikzpicture}
\end{document}
答案1
填充圆 A 和 BC 交点的一种方法是先填充整个图形,然后填充其补图。以下代码来自这里,并添加填充even odd rule
\fill[gray!20,draw,even odd rule] \cirA \cirB;
代码
\documentclass[tikz,border=0.2cm]{standalone}
\begin{document}
\begin{tikzpicture}[thick]
\def\r{1.5} % radius of two circles
\def\d{1} % distance of two centers
\def\cirA{(210:\d) circle(\r)}
\def\cirB{(-30:\d) circle(\r)}
\draw[fill=yellow]
\cirA +(135:\r+.3) node{$A$}
\cirB +(45:\r+.3) node{$B$};
% Fill the complement of intersection of A and B-C
\begin{scope}
\clip \cirA;
\clip \cirB;
\draw[fill=gray!20] (90:\d) circle(\r);
\end{scope}
\fill[gray!20,draw,even odd rule] \cirA \cirB;
% Circles outline
\draw \cirA \cirB;
\end{tikzpicture}
\end{document}
答案2
我的建议很谦虚。有一个非常好的包装文图Nicola LC Talbot 的作品。非常简单。检查图表是否正确。
\documentclass{standalone}
\usepackage{venndiagram}
\begin{document}
\begin{venndiagram3sets}
\fillACapBNotC
\end{venndiagram3sets}
\end{document}
或这个.....
\documentclass{standalone}
\usepackage{venndiagram}
\begin{document}
\begin{venndiagram3sets}
\fillACapBCapC
\end{venndiagram3sets}
\end{document}