维恩图:如何将集合分成两部分

维恩图:如何将集合分成两部分

使用此代码

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{patterns}
\begin{document}

\begin{tikzpicture}
\draw[pattern=north east lines,pattern color=yellow] (4.5,2) ellipse[x radius = 3, 
y radius = 1.5];
\node[yellow!60!black] [at={(2,1.5)}] {$S_T$};
\node[red!40!black] [at={(3.4,1.5)}] {$S_{SR}$};
\draw [pattern=north west lines,pattern color=red] (5,2) ellipse [x radius =2.4, 
y radius = 1.4];
\draw [fill, color=white] (5.5,2) ellipse [x radius =1.8, y radius = 1];
\node [at = {(5,2)}] {$A$};
\end{tikzpicture}
\end{document}

我可以得到下图:

在此处输入图片描述

我想修改由 A 和 S_{SR} 标记的集合,这样中间大小的椭圆被一条线分成两部分:左侧应由 S_{SR} 标记,而右侧应由 A 标记。

下面是我想要应用的更改的草图(为简单起见,无色):

在此处输入图片描述

答案1

这是你想要的结果吗?

在此处输入图片描述

\documentclass[border=5pt]{standalone}

\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usetikzlibrary{patterns,intersections}
\usepgfplotslibrary{fillbetween}
\usepackage{contour}
\contournumber{64}

\begin{document}
    \begin{tikzpicture}
        \draw[pattern=north east lines,pattern color=yellow] (4.5,2) ellipse[x radius=3, y radius=1.5];
                
        \draw [name path=a, fill=white] (5,2) ellipse [x radius =2.4, y radius = 1.4];
        \draw[name path=b] (5,0.6) to[out=135, in=315] (5,3.4);
        
        \draw [
            pattern=north west lines,
            pattern color=red, 
            intersection segments={
                of=a and b,sequence={R2--L2}
            }
        ];
        
        \node[yellow!60!black] at (2,1.5) {\contour{white}{$S_T$}};
        \node[red!40!black] at (3.4,1.5) {\contour{white}{$S_{SR}$}};
        \node at (5.5,1.5) {\contour{white}{$A$}};
    \end{tikzpicture}
\end{document}

相关内容