设计嵌套维恩图

设计嵌套维恩图

有什么方法可以让这些类似的图表看起来更漂亮吗?比如添加特殊设计、颜色等?如果能得到帮助,我将不胜感激。

在此处输入图片描述 在此处输入图片描述

\documentclass[a4paper, 12pt, openany]{book}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\draw (0,0) circle (4cm);
\draw (0,0) circle (3cm);
\draw (0,0) circle (2cm);
\node (a) at (0, 0) {GROUPS};
\node (b) at (0, 2.4) {RINGS};
\node (c) at (0, 3.5) {FIELDS};
\end{tikzpicture}




\begin{tikzpicture}
\draw (0,0) circle (5cm);
\draw (0,0) circle (4cm);
\draw (0,0) circle (3cm);
\draw (0,0) circle (2cm);
\node (a) at (0, 0) {GROUPOIDS};
\node (b) at (0, 2.3) {SEMI-GROUPS};
\node (c) at (0, 3.5) {MONOIDS};
\node (c) at (0, 4.5) {GROUPS};
\end{tikzpicture}
\end{document}

答案1

改编

  • \colorlet{euler1}{red}使用等定义一些颜色。
  • 使用这些颜色定义填充和文本颜色

结果

在此处输入图片描述

代码

\documentclass[a4paper, 12pt, openany]{book}

\usepackage{xcolor}
\usepackage{tikz}

\colorlet{euler1}{red}
\colorlet{euler2}{blue}
\colorlet{euler3}{yellow}
\colorlet{euler4}{green}

\begin{document}

\begin{tikzpicture}
    \draw[fill=euler1!20] (0,0) circle (4cm);
    \draw[fill=euler2!20] (0,0) circle (3cm);
    \draw[fill=euler3!20] (0,0) circle (2cm);
    \node[euler3!30!black] (a) at (0, 0) {GROUPS};
    \node[euler2!30!black] (b) at (0, 2.4) {RINGS};
    \node[euler1!30!black] (c) at (0, 3.5) {FIELDS};
\end{tikzpicture}

\end{document}

自动化

如果它始终是这种结构,您可以为这种图表定义一个命令:

\documentclass[a4paper, 12pt, openany]{book}

\usepackage{tikz}
\usetikzlibrary{calc}

\colorlet{euler1}{red}
\colorlet{euler2}{blue}
\colorlet{euler3}{yellow}
\colorlet{euler4}{green}

\newcommand{\draweuler}[1]{
    \foreach \xname [count=\i] in {#1} {\xdef\n{\i}}
    \foreach \xname [count=\i] in {#1} {
        \draw[fill=euler\i!20] (0,0) circle ({(\n-\i+2)*10mm});
        \node[euler\i!30!black] (g\i) at (0, {ifthenelse(\i==\n, 0, (\n-\i+1.4)*10mm)}) {\xname};
    }
}

\begin{document}

\begin{tikzpicture}
    \draweuler{FIELDS, GROUPS, RINGS}
\end{tikzpicture}

\end{document}

相关内容