填充颜​​色交叉点

填充颜​​色交叉点

如何用不同的颜色填充两个或多个圆圈之间的交叉点?我想要类似于附图的东西。交叉路口

答案1

可以通过剪辑来完成:

\documentclass{article}
\usepackage{tikz}

\definecolor{CircleBlue}{RGB}{0, 163, 232}
\definecolor{CircleYellow}{RGB}{254, 242, 0}
\definecolor{CircleOrange}{RGB}{255, 127, 38}

\begin{document}
\begin{tikzpicture}
  \def\Radius{10mm}
  \def\Distance{13mm}
  \path
    (0, 0) coordinate (C)
    +(120:\Distance) coordinate (A)
    +(60:\Distance) coordinate (B)
  ;
  \begin{scope}[radius=\Radius]
    \def\Circles{
      (A) circle[]
      (B) circle[]
      (C) circle[]
    }
    \fill[CircleBlue] \Circles;

    \begin{scope}
      \clip (A) circle[];
      \clip (B) circle[];
      \fill[CircleYellow] (A) circle[];
    \end{scope}
    \begin{scope}
      \clip (B) circle[];
      \clip (C) circle[];
      \fill[CircleYellow] (B) circle[];
    \end{scope}
    \begin{scope}
      \clip (C) circle[];
      \clip (A) circle[];
      \fill[CircleYellow] (C) circle[];
    \end{scope}

    \begin{scope}
      \clip (A) circle[];
      \clip (B) circle[];
      \clip (C) circle[];
      \fill[CircleOrange] (A) circle[];
    \end{scope}

    \draw[very thick] \Circles;
  \end{scope}
\end{tikzpicture}
\end{document}

结果

一步步:

动画片

生成者:

\documentclass{beamer}
\setbeamertemplate{navigation symbols}{}
\usepackage{tikz}

\definecolor{CircleBlue}{RGB}{0, 163, 232}
\definecolor{CircleYellow}{RGB}{254, 242, 0}
\definecolor{CircleOrange}{RGB}{255, 127, 38}

\begin{document}
\begin{frame}
\begin{tikzpicture}
  \def\Radius{10mm}
  \def\Distance{13mm}
  \path
    (0, 0) coordinate (C)
    +(120:\Distance) coordinate (A)
    +(60:\Distance) coordinate (B)
  ;
  \begin{scope}[radius=\Radius]
    \def\Circles{
      (A) circle[]
      (B) circle[]
      (C) circle[]
    }
    \uncover<2->{
      \fill[CircleBlue] \Circles;
    }

    \uncover<3->{
      \begin{scope}
        \clip (A) circle[];
        \clip (B) circle[];
        \fill[CircleYellow] (A) circle[];
      \end{scope}
    }
    \uncover<4->{
      \begin{scope}
        \clip (B) circle[];
        \clip (C) circle[];
        \fill[CircleYellow] (B) circle[];
      \end{scope}
    }
    \uncover<5->{
      \begin{scope}
        \clip (C) circle[];
        \clip (A) circle[];
        \fill[CircleYellow] (C) circle[];
      \end{scope}
    }

    \uncover<6->{
      \begin{scope}
        \clip (A) circle[];
        \clip (B) circle[];
        \clip (C) circle[];
        \fill[CircleOrange] (A) circle[];
      \end{scope}
    }

    \uncover<7->{
      \draw[very thick] \Circles;
    }
  \end{scope}
\end{tikzpicture}
\end{frame}
\end{document}

答案2

有了venndiagrams,一切就简单了:

    \documentclass[svgnames]{article}
    \usepackage{venndiagram}

    \begin{document}

    \begin{venndiagram3sets}[ radius=1.5cm, overlap=1.2cm]%
        \setkeys{venn}{shade=DodgerBlue!80}
        \fillOnlyA \fillOnlyB \fillOnlyC
        \setkeys{venn}{shade=yellow}
        \fillACapBNotC \fillBCapCNotA \fillACapCNotB
        \setkeys{venn}{shade=orange}
        \fillACapBCapC
    \end{venndiagram3sets}

    \end{document}

在此处输入图片描述

相关内容