我正在尝试从中心圆(大会)到经济及社会理事会和国际刑事法院圆画线,使得这三个圆上的线的入射角均为 0 度,即线与圆的表面成 90 度角。目前,这就是我所得到的。
\documentclass{article}
\usetikzlibrary{calc}
\usetikzlibrary{matrix, shapes}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{snakes}
\usetikzlibrary{positioning, intersections}
\pgfplotsset{compat=1.10}
\begin{document}
\begin{figure}[H]
\label{fig:structure}
\centering
\begin{tikzpicture}
\node[xshift=6cm,draw,regular polygon, regular polygon sides=4,text width=3cm,align=center] (sa)
{{\Large Specialized agencies}:\\
\textbullet FAO\\
\textbullet ILO\\
\textbullet ITU\\
\textbullet WHO};
\node[minimum size= 4.5cm, xshift=12cm,draw,circle, text width=3cm,align=center] (ga) {\Large{General Assembly}\\
\small{1 nation, 1 vote}};
\node[xshift=12cm,yshift=-5cm,draw, circle, text width=3cm,align=center] (sc) {\Large Security Council\\
\small{5 permanent members\\
10 rotating members chosen by GA}};
\node[xshift=12cm,yshift=5cm,draw,circle, text width=3cm,align=center] (sg) {\Large Secretary General\\
\small{Supports GA decisions}};
\node[xshift=17cm,yshift=2cm,draw,circle, text width=3cm,align=center] (ecsoc) {\Large Economic and Social Council
};
\node[xshift=17cm,yshift=-2cm,draw,circle, text width=3cm,align=center] (icc) {\Large International Criminal Court
};
\draw (sa.east) -- (ga.west);
\draw (sg.south) -- (ga.north);
\draw (sc.north) -- (ga.south);
\draw (ga.east) -- (ecsoc.west);
\draw (ga.east) -- (icc.west);
\end{tikzpicture}
\caption{Structure of the United Nations}
\end{figure}
\end{document}
答案1
如果您的意思是它们必须垂直于圆的边界,那么不要--
使用 ,edge[out=0, in=180]
而要使用 中的\draw (ga.east) edge[out=0, in=180] (ecsoc.west);
。这样,线从 0 度(右)处退出,从 180 度(左)处进入。
另外,将 Tikz 库全部写在一个地方,用逗号分隔,后你调用 Tikz 包,这样它就不会产生错误。我通常会列出我需要的所有包,然后在所有包后面列出适用的库。这样也更容易理解和更有条理。
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{positioning, intersections, calc, matrix, shapes, snakes}
\pgfplotsset{compat=1.10}
\begin{document}
\begin{figure}[H]
\label{fig:structure}
\centering
\begin{tikzpicture}
\node[xshift=6cm,draw,regular polygon, regular polygon sides=4,text width=3cm,align=center] (sa)
{{\Large Specialized agencies}:\\
\textbullet FAO\\
\textbullet ILO\\
\textbullet ITU\\
\textbullet WHO};
\node[minimum size= 4.5cm, xshift=12cm,draw,circle, text width=3cm,align=center] (ga) {\Large{General Assembly}\\
\small{1 nation, 1 vote}};
\node[xshift=12cm,yshift=-5cm,draw, circle, text width=3cm,align=center] (sc) {\Large Security Council\\
\small{5 permanent members\\
10 rotating members chosen by GA}};
\node[xshift=12cm,yshift=5cm,draw,circle, text width=3cm,align=center] (sg) {\Large Secretary General\\
\small{Supports GA decisions}};
\node[xshift=17cm,yshift=2cm,draw,circle, text width=3cm,align=center] (ecsoc) {\Large Economic and Social Council
};
\node[xshift=17cm,yshift=-2cm,draw,circle, text width=3cm,align=center] (icc) {\Large International Criminal Court
};
\draw (sa.east) -- (ga.west);
\draw (sg.south) -- (ga.north);
\draw (sc.north) -- (ga.south);
\draw (ga.east) edge[out=0, in=180] (ecsoc.west);
\draw (ga.east) edge[out=0, in=180] (icc.west);
\end{tikzpicture}
\caption{Structure of the United Nations}
\end{figure}
\end{document}
顺便说一句,您可以通过添加“松弛度”键来修改曲线外观。默认值为 1,0 表示直线,增加数字可突出曲线。以下是示例(黑色为标准,或 1):
\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{positioning, intersections, calc, matrix, shapes, snakes}
\pgfplotsset{compat=1.10}
\begin{document}
\begin{tikzpicture}
\node[draw, circle, text width=3cm, align=center] (ga) {\Large General Assembly};
\node[draw, circle, text width=3cm, align=center, xshift=6cm, yshift=3cm] (ecsoc) {\Large Economic and Social Council};
\draw[green] (ga.east) edge[out=0, in=180, looseness=0] (ecsoc.west);
\draw (ga.east) edge[out=0, in=180, looseness=1] (ecsoc.west);
\draw[red] (ga.east) edge[out=0, in=180, looseness=5] (ecsoc.west);
\draw[blue] (ga.east) edge[out=0, in=180, looseness=10] (ecsoc.west);
\end{tikzpicture}
\end{document}