简洁的代码来获得四个等距分布在四个象限的相同图表

简洁的代码来获得四个等距分布在四个象限的相同图表

我画了一片森林、一个向右的箭头、一个向南的箭头和一个标题。我想再重复三次该图,以便它们填满正方形的象限 - 但不绘制周围的正方形。有没有办法用“\foreach”命令做到这一点?此外,有没有办法用“\foreach”命令绘制表示顶点的点?对于这样一个简单的图表,我的代码真的很庞大。

如何正确绘制两个箭头?我希望一个箭头从当前图表边界框东侧的中间绘制到另一个图表副本边界框西侧的中间。另一个箭头也类似。

最后,我想要四片森林图下方的标题。目前,其中一个箭头有些干扰。

这是代码。

\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}

\usepackage{tikz}
\usetikzlibrary{calc,intersections}


\usepackage{pgfplots}
\pgfplotsset{compat=1.11}



\begin{document}

\noindent \hspace*{\fill}
\begin{tikzpicture}[x=0.5cm, y=0.5cm]

%A forest is drawn. One of the vertices is labeled P.
\path (0,0) coordinate (P)
(240:2) coordinate (v1) ($(v1) +(-0.75,0)$) coordinate (v2) ($(v1) +(260:0.75)$) coordinate (v3)
(0,-2.5) coordinate (v4)
($(v4) +(250:1.75)$) coordinate (v5) ($(v5) +(210:1.5)$) coordinate (v6) ($(v4) +(350:1.75)$) coordinate (v7) ($(v7) +(260:1.75)$) coordinate (v8)
(2,0) coordinate (v9) ($(v9) +(45:0.75)$) coordinate (v10) ($(v9) +(285:0.75)$) coordinate (v11);
\path node[anchor=south] at ($(P) +(0,0.15)$){$P$};
\draw[fill] (P) circle (1.5pt);
\draw[fill] (v1) circle (1.5pt);
\draw[fill] (v2) circle (1.5pt);
\draw[fill] (v3) circle (1.5pt);
\draw[fill] (v4) circle (1.5pt);
\draw[fill] (v5) circle (1.5pt);
\draw[fill] (v6) circle (1.5pt);
\draw[fill] (v7) circle (1.5pt);
\draw[fill] (v8) circle (1.5pt);
\draw[fill] (v9) circle (1.5pt);
\draw[fill] (v10) circle (1.5pt);
\draw[fill] (v11) circle (1.5pt);
\draw (P) -- (v1) -- (v2);
\draw (v1) -- (v2);
\draw (v1) -- (v3);
\draw (P) -- (v4) -- (v5) -- (v6);
\draw (v4) -- (v7) -- (v8);
\draw (P) -- (v9) -- (v10);
\draw (v9) -- (v11);

%An arrow directed eastward is drawn.
\draw[-latex] (2.5,2) to[out=30,in=150] (6.5,2);
\path node[anchor=north, align=center, inner sep=0, font=\scriptsize] at ({(2.5+6.5)/2},2){Move to the\\right};

%An arrow directed southward is drawn.
\draw[-latex] (1,-5) to[out=240,in=120] (1,-9);
\path node[anchor=east, align=center, inner sep=0, font=\scriptsize] at ({2-0.15},{(-5-9)/2}){Move to\\the bottom};


%A description for the diagram is written.
\path node[draw, text width=0.5\linewidth, inner sep=2mm, align=center] at (current bounding box.south)
{Four diagrams of a forest;\\
some have vertex $P$, and\\
some have omitted vertex $P$,\\
and some have omitted vertex $P$\\
and edges with an endpoint at $P$};
\end{tikzpicture}
\hspace{\fill}

\end{document}

答案1

我为每个条目添加了边界框以查看效果。您可以注释掉这些行以使条目不带边界框。以下是两个版本的代码:

第一行的图表按其南边缘对齐

我认为这个版本看起来更好。因为有角度的箭头形成了一个相对较好的圆圈。

\documentclass[10pt]{amsart}
\usepackage{amssymb}
\usepackage{mathtools,array}
\usepackage{tikz}
\usetikzlibrary{calc,intersections,arrows.meta,bending}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}

\begin{document}
\begin{tikzpicture}[nodes={inner sep=0, font=\scriptsize,
execute at begin node={\setlength\abovedisplayskip{0.75ex}%
\setlength\belowdisplayskip{0.5ex}%
\setlength\abovedisplayshortskip{0.75ex}%
\setlength\belowdisplayshortskip{0.5ex}}},
shorten/.style={shorten >=#1,shorten <=#1},
pics/fpic/.style={code={#1}}, x=0.75cm, y=0.75cm]
%A forest with a vertex P is drawn.

\matrix[row sep=15em, column sep=15em]{\pic{fpic={
\path (0,0) coordinate (P)
(240:2) coordinate (v1) ($(v1) +(-0.75,0)$) coordinate (v2) ($(v1) +(260:0.75)$) coordinate (v3)
(0,-2.5) coordinate (v4)
($(v4) +(250:1.75)$) coordinate (v5) ($(v5) +(210:1.5)$) coordinate (v6) ($(v4) +(350:1.75)$) coordinate (v7) ($(v7) +(260:1.75)$) coordinate (v8)
(2,0) coordinate (v9) ($(v9) +(45:0.75)$) coordinate (v10) ($(v9) +(285:0.75)$) coordinate (v11);
\path node[anchor=south] at ($(P) +(0,0.15)$){$P$};
\draw[fill] (P) circle (1.5pt);
\draw[fill] (v1) circle (1.5pt);
\draw[fill] (v2) circle (1.5pt);
\draw[fill] (v3) circle (1.5pt);
\draw[fill] (v4) circle (1.5pt);
\draw[fill] (v5) circle (1.5pt);
\draw[fill] (v6) circle (1.5pt);
\draw[fill] (v7) circle (1.5pt);
\draw[fill] (v8) circle (1.5pt);
\draw[fill] (v9) circle (1.5pt);
\draw[fill] (v10) circle (1.5pt);
\draw[fill] (v11) circle (1.5pt);
\draw (P) -- (v1) -- (v2);
\draw (v1) -- (v2);
\draw (v1) -- (v3);
\draw (P) -- (v4) -- (v5) -- (v6);
\draw (v4) -- (v7) -- (v8);
\draw (P) -- (v9) -- (v10);
\draw (v9) -- (v11);
\draw (current bounding box.south west) rectangle (current bounding box.north east);% comment this to make entry without bounding box
\node [inner sep=7.5pt] (firstb) at (current bounding box.south) {};
\node [inner sep=7.5pt] (firstr) at (current bounding box.east) {};
}};
&\pic{fpic={
\path (0,0) coordinate (P)
(0,2) coordinate (R)
(240:2) coordinate (v1) ($(v1) +(-0.75,0)$) coordinate (v2) ($(v1) +(260:0.75)$) coordinate (v3)
(0,-2.5) coordinate (v4)
($(v4) +(250:1.75)$) coordinate (v5) ($(v5) +(210:1.5)$) coordinate (v6) ($(v4) +(350:1.75)$) coordinate (v7) ($(v7) +(260:1.75)$) coordinate (v8)
(2,0) coordinate (v9) ($(v9) +(45:0.75)$) coordinate (v10) ($(v9) +(285:0.75)$) coordinate (v11);
\path node[anchor=east] at ($(P) +(-0.15,0)$){$P$};
\path node[anchor=south] at ($(R) +(0,0.15)$){$R$};
\draw[fill] (P) circle (1.5pt);
\draw[fill] (R) circle (1.5pt);
\draw[fill] (v1) circle (1.5pt);
\draw[fill] (v2) circle (1.5pt);
\draw[fill] (v3) circle (1.5pt);
\draw[fill] (v4) circle (1.5pt);
\draw[fill] (v5) circle (1.5pt);
\draw[fill] (v6) circle (1.5pt);
\draw[fill] (v7) circle (1.5pt);
\draw[fill] (v8) circle (1.5pt);
\draw[fill] (v9) circle (1.5pt);
\draw[fill] (v10) circle (1.5pt);
\draw[fill] (v11) circle (1.5pt);
\draw (P) -- (R);
\draw (P) -- (v1) -- (v2);
\draw (v1) -- (v2);
\draw (v1) -- (v3);
\draw (P) -- (v4) -- (v5) -- (v6);
\draw (v4) -- (v7) -- (v8);
\draw (P) -- (v9) -- (v10);
\draw (v9) -- (v11);
\draw (current bounding box.south west) rectangle (current bounding box.north east);% comment this to make entry without bounding box
\node [shift={(0,-1)},inner sep=7.5pt] (secondl) at (current bounding box.west) {};
\node [inner sep=7.5pt] (secondb) at (current bounding box.south) {};
}}; \\
\pic{fpic={
\path (0,0) coordinate (P)
(240:2) coordinate (v1) ($(v1) +(-0.75,0)$) coordinate (v2) ($(v1) +(260:0.75)$) coordinate (v3)
(0,-2.5) coordinate (v4)
($(v4) +(250:1.75)$) coordinate (v5) ($(v5) +(210:1.5)$) coordinate (v6) ($(v4) +(350:1.75)$) coordinate (v7) ($(v7) +(260:1.75)$) coordinate (v8)
(2,0) coordinate (v9) ($(v9) +(45:0.75)$) coordinate (v10) ($(v9) +(285:0.75)$) coordinate (v11);
\path node[anchor=south] at ($(P) +(0,0.15)$){$P$};
\draw (P) circle (1.5pt);
\draw[fill] (v1) circle (1.5pt);
\draw[fill] (v2) circle (1.5pt);
\draw[fill] (v3) circle (1.5pt);
\draw[fill] (v4) circle (1.5pt);
\draw[fill] (v5) circle (1.5pt);
\draw[fill] (v6) circle (1.5pt);
\draw[fill] (v7) circle (1.5pt);
\draw[fill] (v8) circle (1.5pt);
\draw[fill] (v9) circle (1.5pt);
\draw[fill] (v10) circle (1.5pt);
\draw[fill] (v11) circle (1.5pt);
\draw[dashed] (P) -- (v1) -- (v2);
\draw (v1) -- (v2);
\draw (v1) -- (v3);
\draw[dashed] (P) -- (v4);
\draw (v4) -- (v5) -- (v6);
\draw (v4) -- (v7) -- (v8);
\draw[dashed] (P) -- (v9) -- (v10);
\draw (v9) -- (v11);
\draw (current bounding box.south west) rectangle (current bounding box.north east);% comment this to make entry without bounding box
\node [inner sep=7.5pt] (thirdt) at (current bounding box.north) {};
\node [inner sep=7.5pt] (thirdr) at (current bounding box.east) {};
}};
&\pic{fpic={
\path (0,0) coordinate (P)
(240:2) coordinate (v1) ($(v1) +(-0.75,0)$) coordinate (v2) ($(v1) +(260:0.75)$) coordinate (v3)
(0,-2.5) coordinate (v4)
($(v4) +(250:1.75)$) coordinate (v5) ($(v5) +(210:1.5)$) coordinate (v6) ($(v4) +(350:1.75)$) coordinate (v7) ($(v7) +(260:1.75)$) coordinate (v8)
(2,0) coordinate (v9) ($(v9) +(45:0.75)$) coordinate (v10) ($(v9) +(285:0.75)$) coordinate (v11);
\path node[anchor=south] at ($(P) +(0,0.15)$){$P$};
\draw[fill] (P) circle (1.5pt);
\draw[fill] (v1) circle (1.5pt);
\draw[fill] (v2) circle (1.5pt);
\draw[fill] (v3) circle (1.5pt);
\draw[fill] (v4) circle (1.5pt);
\draw[fill] (v5) circle (1.5pt);
\draw[fill] (v6) circle (1.5pt);
\draw[fill] (v7) circle (1.5pt);
\draw[fill] (v8) circle (1.5pt);
\draw[fill] (v9) circle (1.5pt);
\draw[fill] (v10) circle (1.5pt);
\draw[fill] (v11) circle (1.5pt);
\draw (P) -- (v1) -- (v2);
\draw (v1) -- (v2);
\draw (v1) -- (v3);
\draw (P) -- (v4) -- (v5) -- (v6);
\draw (v4) -- (v7) -- (v8);
\draw (P) -- (v9) -- (v10);
\draw (v9) -- (v11);
\draw (current bounding box.south west) rectangle (current bounding box.north east);% comment this to make entry without bounding box
\node [inner sep=7.5pt] (fourthl) at (current bounding box.west) {};
\node [inner sep=7.5pt] (fourtht) at (current bounding box.north) {};
}}; \\
%\path coordinate (midpoint_of_southern_side_of_original_forest) at (current bounding box.south);
%\path coordinate (midpoint_of_eastern_side_of_original_forest) at (current bounding box.east);
};
\draw[-latex] (firstb) to[out=240,in=120] node[text width=2cm,align=center,right]{Move to the bottom}  (thirdt);
\draw[-latex] (firstr) to[out=30,in=150] node[text width=2cm,align=center,below=2mm]{Move to the right} (secondl);
\draw[-latex] (secondb) to[out=-60,in=60] node[text width=2cm,align=center,left]{Move to the bottom} (fourtht);
\draw[-latex] (thirdr) to[out=-30,in=-150] node[text width=2cm,align=center,above=2mm]{Move to the right} (fourthl);
\path node[draw, text width=0.4\linewidth, inner sep=2mm, align=center] at ($(current bounding box.south) +(0,-2)$)
{Four diagrams of a forest;\\
some have vertex $P$, and\\
some have omitted vertex $P$,\\
and some have omitted vertex $P$\\
and edges with an endpoint at $P$};
\end{tikzpicture}
\end{document}

在此处输入图片描述

第一行的图表垂直居中。

在这个版本中,红色矩形中的箭头对我来说看起来有点奇怪。

\documentclass[10pt]{amsart}
\usepackage{amssymb}
\usepackage{mathtools,array}
\usepackage{tikz}
\usetikzlibrary{calc,intersections,arrows.meta,bending}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}

\begin{document}
\begin{tikzpicture}[nodes={inner sep=0, font=\scriptsize,
execute at begin node={\setlength\abovedisplayskip{0.75ex}%
\setlength\belowdisplayskip{0.5ex}%
\setlength\abovedisplayshortskip{0.75ex}%
\setlength\belowdisplayshortskip{0.5ex}}},
shorten/.style={shorten >=#1,shorten <=#1},
pics/fpic/.style={code={#1}}, x=0.75cm, y=0.75cm]
%A forest with a vertex P is drawn.

\matrix[row sep=15em, column sep=15em]{\pic[shift={(0,1)}]{fpic={
\path (0,0) coordinate (P)
(240:2) coordinate (v1) ($(v1) +(-0.75,0)$) coordinate (v2) ($(v1) +(260:0.75)$) coordinate (v3)
(0,-2.5) coordinate (v4)
($(v4) +(250:1.75)$) coordinate (v5) ($(v5) +(210:1.5)$) coordinate (v6) ($(v4) +(350:1.75)$) coordinate (v7) ($(v7) +(260:1.75)$) coordinate (v8)
(2,0) coordinate (v9) ($(v9) +(45:0.75)$) coordinate (v10) ($(v9) +(285:0.75)$) coordinate (v11);
\path node[anchor=south] at ($(P) +(0,0.15)$){$P$};
\draw[fill] (P) circle (1.5pt);
\draw[fill] (v1) circle (1.5pt);
\draw[fill] (v2) circle (1.5pt);
\draw[fill] (v3) circle (1.5pt);
\draw[fill] (v4) circle (1.5pt);
\draw[fill] (v5) circle (1.5pt);
\draw[fill] (v6) circle (1.5pt);
\draw[fill] (v7) circle (1.5pt);
\draw[fill] (v8) circle (1.5pt);
\draw[fill] (v9) circle (1.5pt);
\draw[fill] (v10) circle (1.5pt);
\draw[fill] (v11) circle (1.5pt);
\draw (P) -- (v1) -- (v2);
\draw (v1) -- (v2);
\draw (v1) -- (v3);
\draw (P) -- (v4) -- (v5) -- (v6);
\draw (v4) -- (v7) -- (v8);
\draw (P) -- (v9) -- (v10);
\draw (v9) -- (v11);
\draw (current bounding box.south west) rectangle (current bounding box.north east);% comment this to make entry without bounding box
\node [inner sep=7.5pt] (firstb) at (current bounding box.south) {};
\node [inner sep=7.5pt] (firstr) at (current bounding box.east) {};
}};
&\pic{fpic={
\path (0,0) coordinate (P)
(0,2) coordinate (R)
(240:2) coordinate (v1) ($(v1) +(-0.75,0)$) coordinate (v2) ($(v1) +(260:0.75)$) coordinate (v3)
(0,-2.5) coordinate (v4)
($(v4) +(250:1.75)$) coordinate (v5) ($(v5) +(210:1.5)$) coordinate (v6) ($(v4) +(350:1.75)$) coordinate (v7) ($(v7) +(260:1.75)$) coordinate (v8)
(2,0) coordinate (v9) ($(v9) +(45:0.75)$) coordinate (v10) ($(v9) +(285:0.75)$) coordinate (v11);
\path node[anchor=east] at ($(P) +(-0.15,0)$){$P$};
\path node[anchor=south] at ($(R) +(0,0.15)$){$R$};
\draw[fill] (P) circle (1.5pt);
\draw[fill] (R) circle (1.5pt);
\draw[fill] (v1) circle (1.5pt);
\draw[fill] (v2) circle (1.5pt);
\draw[fill] (v3) circle (1.5pt);
\draw[fill] (v4) circle (1.5pt);
\draw[fill] (v5) circle (1.5pt);
\draw[fill] (v6) circle (1.5pt);
\draw[fill] (v7) circle (1.5pt);
\draw[fill] (v8) circle (1.5pt);
\draw[fill] (v9) circle (1.5pt);
\draw[fill] (v10) circle (1.5pt);
\draw[fill] (v11) circle (1.5pt);
\draw (P) -- (R);
\draw (P) -- (v1) -- (v2);
\draw (v1) -- (v2);
\draw (v1) -- (v3);
\draw (P) -- (v4) -- (v5) -- (v6);
\draw (v4) -- (v7) -- (v8);
\draw (P) -- (v9) -- (v10);
\draw (v9) -- (v11);
\draw (current bounding box.south west) rectangle (current bounding box.north east);% comment this to make entry without bounding box
\node [inner sep=7.5pt] (secondl) at (current bounding box.west) {};
\node [inner sep=7.5pt] (secondb) at (current bounding box.south) {};
}}; \\
\pic{fpic={
\path (0,0) coordinate (P)
(240:2) coordinate (v1) ($(v1) +(-0.75,0)$) coordinate (v2) ($(v1) +(260:0.75)$) coordinate (v3)
(0,-2.5) coordinate (v4)
($(v4) +(250:1.75)$) coordinate (v5) ($(v5) +(210:1.5)$) coordinate (v6) ($(v4) +(350:1.75)$) coordinate (v7) ($(v7) +(260:1.75)$) coordinate (v8)
(2,0) coordinate (v9) ($(v9) +(45:0.75)$) coordinate (v10) ($(v9) +(285:0.75)$) coordinate (v11);
\path node[anchor=south] at ($(P) +(0,0.15)$){$P$};
\draw (P) circle (1.5pt);
\draw[fill] (v1) circle (1.5pt);
\draw[fill] (v2) circle (1.5pt);
\draw[fill] (v3) circle (1.5pt);
\draw[fill] (v4) circle (1.5pt);
\draw[fill] (v5) circle (1.5pt);
\draw[fill] (v6) circle (1.5pt);
\draw[fill] (v7) circle (1.5pt);
\draw[fill] (v8) circle (1.5pt);
\draw[fill] (v9) circle (1.5pt);
\draw[fill] (v10) circle (1.5pt);
\draw[fill] (v11) circle (1.5pt);
\draw[dashed] (P) -- (v1) -- (v2);
\draw (v1) -- (v2);
\draw (v1) -- (v3);
\draw[dashed] (P) -- (v4);
\draw (v4) -- (v5) -- (v6);
\draw (v4) -- (v7) -- (v8);
\draw[dashed] (P) -- (v9) -- (v10);
\draw (v9) -- (v11);
\draw (current bounding box.south west) rectangle (current bounding box.north east);% comment this to make entry without bounding box
\node [inner sep=7.5pt] (thirdt) at (current bounding box.north) {};
\node [inner sep=7.5pt] (thirdr) at (current bounding box.east) {};
}};
&\pic{fpic={
\path (0,0) coordinate (P)
(240:2) coordinate (v1) ($(v1) +(-0.75,0)$) coordinate (v2) ($(v1) +(260:0.75)$) coordinate (v3)
(0,-2.5) coordinate (v4)
($(v4) +(250:1.75)$) coordinate (v5) ($(v5) +(210:1.5)$) coordinate (v6) ($(v4) +(350:1.75)$) coordinate (v7) ($(v7) +(260:1.75)$) coordinate (v8)
(2,0) coordinate (v9) ($(v9) +(45:0.75)$) coordinate (v10) ($(v9) +(285:0.75)$) coordinate (v11);
\path node[anchor=south] at ($(P) +(0,0.15)$){$P$};
\draw[fill] (P) circle (1.5pt);
\draw[fill] (v1) circle (1.5pt);
\draw[fill] (v2) circle (1.5pt);
\draw[fill] (v3) circle (1.5pt);
\draw[fill] (v4) circle (1.5pt);
\draw[fill] (v5) circle (1.5pt);
\draw[fill] (v6) circle (1.5pt);
\draw[fill] (v7) circle (1.5pt);
\draw[fill] (v8) circle (1.5pt);
\draw[fill] (v9) circle (1.5pt);
\draw[fill] (v10) circle (1.5pt);
\draw[fill] (v11) circle (1.5pt);
\draw (P) -- (v1) -- (v2);
\draw (v1) -- (v2);
\draw (v1) -- (v3);
\draw (P) -- (v4) -- (v5) -- (v6);
\draw (v4) -- (v7) -- (v8);
\draw (P) -- (v9) -- (v10);
\draw (v9) -- (v11);
\draw (current bounding box.south west) rectangle (current bounding box.north east);% comment this to make entry without bounding box
\node [inner sep=7.5pt] (fourthl) at (current bounding box.west) {};
\node [inner sep=7.5pt] (fourtht) at (current bounding box.north) {};
}}; \\
%\path coordinate (midpoint_of_southern_side_of_original_forest) at (current bounding box.south);
%\path coordinate (midpoint_of_eastern_side_of_original_forest) at (current bounding box.east);
};
\draw[-latex] (firstb) to[out=240,in=120] node[text width=2cm,align=center,right]{Move to the bottom}  (thirdt);
\draw[-latex] (firstr) to[out=30,in=150] node[text width=2cm,align=center,below=2mm]{Move to the right} (secondl);
\draw[-latex] (secondb) to[out=-60,in=60] node[text width=2cm,align=center,left]{Move to the bottom} (fourtht);
\draw[-latex] (thirdr) to[out=-30,in=-150] node[text width=2cm,align=center,above=2mm]{Move to the right} (fourthl);
\path node[draw, text width=0.4\linewidth, inner sep=2mm, align=center] at ($(current bounding box.south) +(0,-2)$)
{Four diagrams of a forest;\\
some have vertex $P$, and\\
some have omitted vertex $P$,\\
and some have omitted vertex $P$\\
and edges with an endpoint at $P$};
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

  • 您的问题不完全清楚,尤其是箭头和框在哪里以及一些描述。
  • 由于您在评论中说,我不希望编辑我的第一个答案,所以我将其删除并决定,如果我有空闲时间,我最终会写一个新的答案。
  • 现在,找到一些空闲时间后,决定再次试试运气,猜猜你的图片应该是什么样子。我认为这是你评论中给出的链接上问题的第一个版本。
  • 但是,我还是不确定你的问题是什么。遗憾的是,到目前为止,你还不愿意向我们展示你想要的草图。

編輯: 看来@Tom 有水晶球,可以透露原帖者想要什么(可惜我的水晶球坏了)。考虑到他的猜测,解决方案的代码也可以是:

\documentclass{amsart}
%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                bending,
                calc,
                fit,
                matrix,
                positioning,
                quotes}

\begin{document}
    \begin{center}
\begin{tikzpicture}[x=0.75cm, y=0.75cm,
                    auto,
                    node distance = 45mm and 19mm,
dot/.style = {circle, fill, inner sep=2pt, outer sep=0pt},
     nodes = {font=\footnotesize}, %   inner sep=0, font=\scriptsize
arr/.style = {-{Straight Barb[flex]}, thick, shorten >=#1,shorten <=#1,
              align=center},  
 pics/fpic/.style = {code={#1}}, 
                    ]
%A forest with a vertex P is drawn.

\matrix  (M) [row sep=13em, column sep=9em
             ] 
{
% first "forest"
\pic{fpic={\draw
        (0,0)                   node[dot, label=$P$] (P) {}
     -- (240:2)                 node[dot] (v1) {}
     -- ($(v1)+(-0.75,0)$)      node[dot] (v2) {}
        ($(v1)+(260:0.75)$)     node[dot] (v3) {}
        (0,-2.5)                node[dot] (v4) {}
     -- ($(v4) +(250:1.75)$)    node[dot] (v5) {}
     -- ($(v5) +(210:1.5)$)     node[dot] (v6) {}
        ($(v4) +(350:1.75)$)    node[dot] (v7) {}
     -- ($(v7) +(260:1.75)$)    node[dot] (v8) {}
        (2,0)                   node[dot] (v9) {}
     -- ($(v9) +(45:0.75)$)     node[dot] (v10)  {}
        ($(v9) +(285:0.75)$)    node[dot] (v11)  {};
\draw
    (P) -- (v4)
    (P) -- (v9)
    (v1) -- (v3)
    (v4) -- (v7)
    (v9) -- (v11);
    }};
    &   % second "forest"
\pic{fpic={\draw
        (0,2)                   node[dot, label=$R$] (R) {}
     -- (0,0)                   node[dot, label=left:$P$] (P) {}
     -- (240:2)                 node[dot] (v1) {}
     -- ($(v1)+(-0.75,0)$)      node[dot] (v2) {}
        ($(v1)+(260:0.75)$)     node[dot] (v3) {}
        (0,-2.5)                node[dot] (v4) {}
     -- ($(v4) +(250:1.75)$)    node[dot] (v5) {}
     -- ($(v5) +(210:1.5)$)     node[dot] (v6) {}
        ($(v4) +(350:1.75)$)    node[dot] (v7) {}
     -- ($(v7) +(260:1.75)$)    node[dot] (v8) {}
        (2,0)                   node[dot] (v9) {}
     -- ($(v9) +(45:0.75)$)     node[dot] (v10)  {}
        ($(v9) +(285:0.75)$)    node[dot] (v11)  {};
\draw
    (P) -- (v4)
    (P) -- (v9)
    (v1) -- (v3)
    (v4) -- (v7)
    (v9) -- (v11);
    }};                 \\
% third "forest"
\pic{fpic={\draw
        (0,0)                   node[dot, label=$P$] (P) {}
        (240:2)                 node[dot] (v1) {}
        ($(v1)+(-0.75,0)$)      node[dot] (v2) {}
        ($(v1)+(260:0.75)$)     node[dot] (v3) {}
        (0,-2.5)                node[dot] (v4) {}
     -- ($(v4) +(250:1.75)$)    node[dot] (v5) {}
     -- ($(v5) +(210:1.5)$)     node[dot] (v6) {}
        ($(v4) +(350:1.75)$)    node[dot] (v7) {}
     -- ($(v7) +(260:1.75)$)    node[dot] (v8) {}
        (2,0)                   node[dot] (v9) {}
     -- ($(v9) +(45:0.75)$)     node[dot] (v10)  {}
        ($(v9) +(285:0.75)$)    node[dot] (v11)  {};
\draw[dashed]   (P) -- (v1) 
                (P) -- (v4)
                (P) -- (v9);
\draw   (v2) -- (v1) -- (v3)
        (v4) -- (v7)
        (v9) -- (v11);
}};
    &   % fourth "forest"
\pic{fpic={\draw
        (0,0)                   node[dot, label=$P$] (P) {}
     -- (240:2)                 node[dot] (v1) {}
     -- ($(v1)+(-0.75,0)$)      node[dot] (v2) {}
        ($(v1)+(260:0.75)$)     node[dot] (v3) {}
        (0,-2.5)                node[dot] (v4) {}
     -- ($(v4) +(250:1.75)$)    node[dot] (v5) {}
     -- ($(v5) +(210:1.5)$)     node[dot] (v6) {}
        ($(v4) +(350:1.75)$)    node[dot] (v7) {}
     -- ($(v7) +(260:1.75)$)    node[dot] (v8) {}
        (2,0)                   node[dot] (v9) {}
     -- ($(v9) +(45:0.75)$)     node[dot] (v10)  {}
        ($(v9) +(285:0.75)$)    node[dot] (v11)  {};
\draw
    (P) -- (v4)
    (P) -- (v9)
    (v1) -- (v3)
    (v4) -- (v7)
    (v9) -- (v11);
    }};                 \\
};
% arrows on circle
\draw[arr=1em]   (M.center) ++ (110:45mm) arc (110: 65:45mm) 
            node[pos=0.5,above] {move to\\ the right};
\draw[arr=1em]
    (M.center) ++ (245:45mm) arc (245:295:45mm) 
            node[pos=0.5,below]  {move to\\ the bottom};
\draw[arr=1em]
    (M.center) ++ (175:45mm) arc (175:205:45mm) 
            node[pos=0.5,left] {move to\\ the right};
\draw[arr=1em]
    (M.center) ++ (  5:45mm) arc (  5:-25:45mm)
            node[pos=0.5,right]  {move to\\ the bottom};
    
% arrow directed southward
\node[draw, text width=0.5\linewidth, align=left,
      below = 3mm of M]
     {\textbf{Four diagrams of a forest:}\\
      some have vertex $P$, some have omitted vertex $P$,
      and some have omitted vertex $P$ and edges with an endpoint at $P$};
\end{tikzpicture}
    \end{center}
\end{document}

通过对所讨论的 MWE 以及@To 答案的比较,您可以观察到,上述 MWE 中的代码更短更简单。

在此处输入图片描述

(红线表示页面布局)

相关内容