
私の仕事では、3 つの円があり、交差部分が線で 2 つに分割されているベン図が必要です。
Tex.SE の回答を使用しましたが、それを使用して介在線を描画し、図のように網掛けする方法がわかりません。誰か助けてくれませんか?
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\tikzset{venn circle/.style={draw,circle,minimum width=6cm,fill=#1,opacity=0.4}}
\node [venn circle = red] (A) at (0,0) {$A$};
\node [venn circle = blue] (B) at (60:4cm) {$B$};
\node [venn circle = green] (C) at (0:4cm) {$C$};
\node[left] at (barycentric cs:A=1/2,B=1/2 ) {$A \cap B$};
\node[below] at (barycentric cs:A=1/2,C=1/2 ) {$A \cap C$};
\node[right] at (barycentric cs:B=1/2,C=1/2 ) {$B \cap C$};
\node[below] at (barycentric cs:A=1/3,B=1/3,C=1/3 ){$A \cap B \cap C$};
\end{tikzpicture}
\end{document}
答え1
おそらく、もう少し改良できると思いますが、これで基本的に質問の答えになると思います。必要なのは、希望するパターンや塗りつぶしを作成するために使用できるパスを構築することです。したがって、円の交点を計算し、それを座標に渡します。これらの座標を使用して、円の中心と交点の間の角度を計算し、最終的に円弧を使用して塗りつぶしたい形状を作成できます。A、B、C の重なり合う領域を分離する交線を作成するには、基本的に、円 B の交点と、A と C の 2 つの交点間の線を計算します。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}
\tikzset{venn circle/.style={draw,circle,minimum width=6cm,fill=#1,opacity=0.4,text opacity=1}}
\node [name path=A, venn circle = red] (A) at (0,0) {$A$};
\node [name path=B, venn circle = blue] (B) at (60:4cm) {$B$};
\node [name path=C, venn circle = green] (C) at (0:4cm) {$C$};
% intersection points between circles A and B
\path [name intersections={of = A and B}];
\coordinate (AB1) at (intersection-1);
\coordinate (AB2) at (intersection-2);
% intersection points between circles B and C
\path [name intersections={of = B and C}];
\coordinate (BC1) at (intersection-1);
\coordinate (BC2) at (intersection-2);
% intersection points between circles A and C
\path [name intersections={of = A and C}];
\coordinate (AC1) at (intersection-1);
\coordinate (AC2) at (intersection-2);
% constructing path from AC1 to AC2 and calculating intersection point with circle B
\path [name path=AC] (AC1)--(AC2);
\path [name intersections={of = AC and B}];
\coordinate (ACB1) at (intersection-1);
% calculate angles from center of A/B to intersection points
\pgfmathanglebetweenpoints{\pgfpointanchor{A}{center}}{\pgfpointanchor{AB2}{center}}
\let\AABtwo\pgfmathresult
\pgfmathanglebetweenpoints{\pgfpointanchor{A}{center}}{\pgfpointanchor{AC1}{center}}
\let\AACone\pgfmathresult
\pgfmathanglebetweenpoints{\pgfpointanchor{B}{center}}{\pgfpointanchor{AB2}{center}}
\let\BABtwo\pgfmathresult
\pgfmathanglebetweenpoints{\pgfpointanchor{B}{center}}{\pgfpointanchor{ACB1}{center}}
\let\BACBone\pgfmathresult
% calculate angles from center of B/C to intersection points
\pgfmathanglebetweenpoints{\pgfpointanchor{B}{center}}{\pgfpointanchor{ACB1}{center}}
\let\CACBone\pgfmathresult
\pgfmathanglebetweenpoints{\pgfpointanchor{B}{center}}{\pgfpointanchor{BC2}{center}}
\let\BBCtwo\pgfmathresult
\pgfmathanglebetweenpoints{\pgfpointanchor{C}{center}}{\pgfpointanchor{AC1}{center}}
\let\CACone\pgfmathresult
\pgfmathanglebetweenpoints{\pgfpointanchor{C}{center}}{\pgfpointanchor{BC2}{center}}
\let\CBCtwo\pgfmathresult
% calculate angles from center of A/C to intersection points
\pgfmathanglebetweenpoints{\pgfpointanchor{A}{center}}{\pgfpointanchor{AC1}{center}}
\let\AACone\pgfmathresult
\pgfmathanglebetweenpoints{\pgfpointanchor{A}{center}}{\pgfpointanchor{AC2}{center}}
\let\AACtwo\pgfmathresult
\pgfmathanglebetweenpoints{\pgfpointanchor{C}{center}}{\pgfpointanchor{AC1}{center}}
\let\CACone\pgfmathresult
\pgfmathanglebetweenpoints{\pgfpointanchor{C}{center}}{\pgfpointanchor{AC2}{center}}
\let\CACtwo\pgfmathresult
% draw patterns
\pattern[pattern=horizontal lines, pattern color=red]
(AB2) arc[start angle=\AABtwo, end angle=\AACone,radius=3cm] -- (ACB1) --
(ACB1) arc[start angle=\BACBone, end angle=\BABtwo,radius=3cm];
\pattern[pattern=horizontal lines, , pattern color=blue]
(BC2) arc[start angle=\BBCtwo, end angle=\BACBone,radius=3cm] -- (AC1)
(AC1) arc[start angle=\CACone, end angle=\CBCtwo,radius=3cm];
% draw separation line
\draw [thick] (AC1)--(ACB1);
% print annotations
\node[left, fill=white, fill opacity=0.5, text opacity=1, inner sep=1.5pt]
at (barycentric cs:A=1/2,B=1/2 ) {$A \cap B$};
\node[below, fill=white, fill opacity=0.5, text opacity=1, inner sep=1.5pt]
at (barycentric cs:A=1/2,C=1/2 ) {$A \cap C$};
\node[right, fill=white, fill opacity=0.5, text opacity=1, inner sep=1.5pt]
at (barycentric cs:B=1/2,C=1/2 ) {$B \cap C$};
\node[below, fill=white, fill opacity=0.5, text opacity=1, inner sep=1.5pt]
at (barycentric cs:A=1/3,B=1/3,C=1/3 ){$A \cap B \cap C$};
\end{tikzpicture}
\end{document}