在使用 tikz 的 LATEX 中,无法在两个圆内创建具有交集的节点
Trouble making nodes inside two circles with intersection in LATEX using tikz
我制作了一个社交图,如下所示,但无法找到一种方法让节点位于两个圆圈内,其中中间的节点(F、D、K、M)是放在两个圆的交点。
有没有简单的方法来标记左圆、右圆和交点?
这是代码,非常感谢您:
\begin{tikzpicture}
\begin{scope}[every node/.style={circle,thick,draw}]
\node (A) at (0,0) {A};
\node (B) at (0,3) {B};
\node (C) at (2,3) {C};
\node (E) at (1,-1.5) {E};
\node (G) at (1,1.5) {G};
\node (F) at (5,2) {F} ;
\node (D) at (4,1) {D};
\node (K) at (5,0) {K};
\node (M) at (4,-1) {M};
\node (H) at (8.5,0) {H};
\node (I) at (9,2.5) {I};
\node (J) at (8,1.5) {J};
\node (N) at (7.5,-1.5) {N};
\node (L) at (7,3) {L} ;
\node (Q) at (9.5,1) {Q} ;
\end{scope}
\begin{scope}[>={Stealth[black]},
every node/.style={fill=white,circle},
every edge/.style={draw=red,very thick}]
\draw (A) -> (G);
\draw (B) -- (A);
\draw (B) -- (C);
\draw (B) -- (G);
\draw (E) -- (G);
\draw (E) -- (A);
\draw (G) -- (C);
\draw (L) -- (I);
\draw (H) -- (J);
\draw (Q) -- (H);
\draw (I) -- (J);
\draw (N) -- (H);
\draw (Q) -- (J);
\draw (A) -> (D);
\draw (E) -- (M);
\draw (E) -- (D);
\draw (G) -- (D);
\draw (G) -- (F);
\draw (C) -- (F);
\draw (C) -- (M);
\draw (N) -- (K);
\draw (N) -- (F);
\draw (N) -- (M);
\draw (L) -- (F);
\draw (J) -- (F);
\draw (H) -- (F);
\end{scope}
\end{tikzpicture}
更新:
添加这两行后:
\画(2,0.7)圆(4cm);
\画(7,0.7)圈(4cm);
我明白了:
我只剩下给交点着色,所以在我添加的这两行下面:
%\画夹圈(4cm);
%\fill[gray](2,0.7)圆(4cm);
哪个完成了这项工作,但其中一个圆圈隐藏了它的节点!!
有什么建议吗??
我想这就是您要找的:
\begin{tikzpicture}
\begin{scope}
\draw (2,0.7) circle (4cm);
\clip (7,0.7) circle (4cm);
\fill[gray] (2,0.7) circle (4cm);
\draw (7,0.7) circle (4cm);
\end{scope}
\node[below=4.5cm of circle1] {Circle 1};
\node[below=4.5cm of circle2] {Circle 2};
\node[below=4cm of circle1,xshift=2.5cm] {Intersection};
\begin{scope}[every node/.style={circle,thick,draw}]
\node (A) at (0,0) {A};
\node (B) at (0,3) {B};
\node (C) at (2,3) {C};
\node (E) at (1,-1.5) {E};
\node (G) at (1,1.5) {G};
\node (F) at (5,2) {F} ;
\node (D) at (4,1) {D};
\node (K) at (5,0) {K};
\node (M) at (4,-1) {M};
\node (H) at (8.5,0) {H};
\node (I) at (9,2.5) {I};
\node (J) at (8,1.5) {J};
\node (N) at (7.5,-1.5) {N};
\node (L) at (7,3) {L} ;
\node (Q) at (9.5,1) {Q} ;
\end{scope}
\begin{scope}[>={Stealth[black]},
every node/.style={fill=white,circle},
every edge/.style={draw=red,very thick}]
\draw (A) -> (G);
\draw (B) -- (A);
\draw (B) -- (C);
\draw (B) -- (G);
\draw (E) -- (G);
\draw (E) -- (A);
\draw (G) -- (C);
\draw (L) -- (I);
\draw (H) -- (J);
\draw (Q) -- (H);
\draw (I) -- (J);
\draw (N) -- (H);
\draw (Q) -- (J);
\draw (A) -> (D);
\draw (E) -- (M);
\draw (E) -- (D);
\draw (G) -- (D);
\draw (G) -- (F);
\draw (C) -- (F);
\draw (C) -- (M);
\draw (N) -- (K);
\draw (N) -- (F);
\draw (N) -- (M);
\draw (L) -- (F);
\draw (J) -- (F);
\draw (H) -- (F);
\end{scope}
\end{tikzpicture}
没有看到你是如何添加剪辑和填充说明的,我真的不能告诉你哪里出了问题。
我制作了一个社交图,如下所示,但无法找到一种方法让节点位于两个圆圈内,其中中间的节点(F、D、K、M)是放在两个圆的交点。
有没有简单的方法来标记左圆、右圆和交点?
这是代码,非常感谢您:
\begin{tikzpicture}
\begin{scope}[every node/.style={circle,thick,draw}]
\node (A) at (0,0) {A};
\node (B) at (0,3) {B};
\node (C) at (2,3) {C};
\node (E) at (1,-1.5) {E};
\node (G) at (1,1.5) {G};
\node (F) at (5,2) {F} ;
\node (D) at (4,1) {D};
\node (K) at (5,0) {K};
\node (M) at (4,-1) {M};
\node (H) at (8.5,0) {H};
\node (I) at (9,2.5) {I};
\node (J) at (8,1.5) {J};
\node (N) at (7.5,-1.5) {N};
\node (L) at (7,3) {L} ;
\node (Q) at (9.5,1) {Q} ;
\end{scope}
\begin{scope}[>={Stealth[black]},
every node/.style={fill=white,circle},
every edge/.style={draw=red,very thick}]
\draw (A) -> (G);
\draw (B) -- (A);
\draw (B) -- (C);
\draw (B) -- (G);
\draw (E) -- (G);
\draw (E) -- (A);
\draw (G) -- (C);
\draw (L) -- (I);
\draw (H) -- (J);
\draw (Q) -- (H);
\draw (I) -- (J);
\draw (N) -- (H);
\draw (Q) -- (J);
\draw (A) -> (D);
\draw (E) -- (M);
\draw (E) -- (D);
\draw (G) -- (D);
\draw (G) -- (F);
\draw (C) -- (F);
\draw (C) -- (M);
\draw (N) -- (K);
\draw (N) -- (F);
\draw (N) -- (M);
\draw (L) -- (F);
\draw (J) -- (F);
\draw (H) -- (F);
\end{scope}
\end{tikzpicture}
更新:
添加这两行后:
\画(2,0.7)圆(4cm);
\画(7,0.7)圈(4cm);
我明白了:
我只剩下给交点着色,所以在我添加的这两行下面:
%\画夹圈(4cm);
%\fill[gray](2,0.7)圆(4cm);
哪个完成了这项工作,但其中一个圆圈隐藏了它的节点!!
有什么建议吗??
我想这就是您要找的:
\begin{tikzpicture}
\begin{scope}
\draw (2,0.7) circle (4cm);
\clip (7,0.7) circle (4cm);
\fill[gray] (2,0.7) circle (4cm);
\draw (7,0.7) circle (4cm);
\end{scope}
\node[below=4.5cm of circle1] {Circle 1};
\node[below=4.5cm of circle2] {Circle 2};
\node[below=4cm of circle1,xshift=2.5cm] {Intersection};
\begin{scope}[every node/.style={circle,thick,draw}]
\node (A) at (0,0) {A};
\node (B) at (0,3) {B};
\node (C) at (2,3) {C};
\node (E) at (1,-1.5) {E};
\node (G) at (1,1.5) {G};
\node (F) at (5,2) {F} ;
\node (D) at (4,1) {D};
\node (K) at (5,0) {K};
\node (M) at (4,-1) {M};
\node (H) at (8.5,0) {H};
\node (I) at (9,2.5) {I};
\node (J) at (8,1.5) {J};
\node (N) at (7.5,-1.5) {N};
\node (L) at (7,3) {L} ;
\node (Q) at (9.5,1) {Q} ;
\end{scope}
\begin{scope}[>={Stealth[black]},
every node/.style={fill=white,circle},
every edge/.style={draw=red,very thick}]
\draw (A) -> (G);
\draw (B) -- (A);
\draw (B) -- (C);
\draw (B) -- (G);
\draw (E) -- (G);
\draw (E) -- (A);
\draw (G) -- (C);
\draw (L) -- (I);
\draw (H) -- (J);
\draw (Q) -- (H);
\draw (I) -- (J);
\draw (N) -- (H);
\draw (Q) -- (J);
\draw (A) -> (D);
\draw (E) -- (M);
\draw (E) -- (D);
\draw (G) -- (D);
\draw (G) -- (F);
\draw (C) -- (F);
\draw (C) -- (M);
\draw (N) -- (K);
\draw (N) -- (F);
\draw (N) -- (M);
\draw (L) -- (F);
\draw (J) -- (F);
\draw (H) -- (F);
\end{scope}
\end{tikzpicture}
没有看到你是如何添加剪辑和填充说明的,我真的不能告诉你哪里出了问题。