如何在页面上很好地排列一组子图?

如何在页面上很好地排列一组子图?

我有以下代码,它在页面上的显示效果很尴尬...理想情况下,我希望它适合一页,但我是 Tikz 新手,我想通过示例来说明。有没有什么方法可以扩展?我应该用其他方法吗?

\begin{figure}
\centering
\begin{subfigure}[b]{.45\linewidth}
\centering
\begin{tikzpicture}   
    \tikzset{vertex/.style = {shape=circle,draw,minimum size=1.5em}}
    \tikzset{edge/.style = {->,> = latex'}}
    % vertices
    \node[vertex] (a) at  (0,0) {5};
    \node[vertex] (f) at  (2,0) {6};
    \node[vertex] (b) at  (1,2) {4};
    \node[vertex] (c) at  (1,4) {3};
    \node[vertex] (d) at  (0,6) {1};
    \node[vertex] (e) at  (2,6) {2};
    \node[vertex] (a2) at  (4,0) {11};
    \node[vertex] (f2) at  (6,0) {12};
    \node[vertex] (b2) at  (5,2) {10};
    \node[vertex] (c2) at  (5,4) {9};
    \node[vertex] (d2) at  (4,6) {7};
    \node[vertex] (e2) at  (6,6) {8};
    %edges
    \draw[edge] (b) to (a);
    \draw[edge] (b) to (c);
    \draw[edge] (e) to (c);
    \draw[edge] (e) to (d);
    \draw[edge] (d) to (c);
    \draw[edge] (f) to (b);
    \draw[edge] (b2) to (a2);
    \draw[edge] (b2) to (c2);
    \draw[edge] (e2) to (c2);
    \draw[edge] (e2) to (d2);
    \draw[edge] (d2) to (c2);
    \draw[edge] (f2) to (b2);
    \draw[edge, dashed] (d2) to (e);
\end{tikzpicture}
\caption{Type I}
\end{subfigure}
\begin{subfigure}[b]{.45\linewidth}
\centering
\begin{tikzpicture}   
    \tikzset{vertex/.style = {shape=circle,draw,minimum size=1.5em}}
    \tikzset{edge/.style = {->,> = latex'}}
    % vertices
    \node[vertex] (a) at  (0,0) {5};
    \node[vertex] (f) at  (2,0) {6};
    \node[vertex] (b) at  (1,2) {4};
    \node[vertex] (c) at  (1,4) {3};
    \node[vertex] (d) at  (0,6) {1};
    \node[vertex] (e) at  (2,6) {2};
    \node[vertex] (a2) at  (4,0) {11};
    \node[vertex] (f2) at  (6,0) {12};
    \node[vertex] (b2) at  (5,2) {10};
    \node[vertex] (c2) at  (5,4) {9};
    \node[vertex] (d2) at  (4,6) {7};
    \node[vertex] (e2) at  (6,6) {8};
    %edges
    \draw[edge] (b) to (a);
    \draw[edge] (b) to (c);
    \draw[edge] (e) to (c);
    \draw[edge] (e) to (d);
    \draw[edge] (d) to (c);
    \draw[edge] (f) to (b);
    \draw[edge] (b2) to (a2);
    \draw[edge] (b2) to (c2);
    \draw[edge] (e2) to (c2);
    \draw[edge] (e2) to (d2);
    \draw[edge] (d2) to (c2);
    \draw[edge] (f2) to (b2);
    \draw[edge, dashed] (d2) to (e);
\end{tikzpicture}
\caption{Type II}
\end{subfigure}
\begin{subfigure}[b]{.45\linewidth}
\begin{tikzpicture}   
    \tikzset{vertex/.style = {shape=circle,draw,minimum size=1.5em}}
    \tikzset{edge/.style = {->,> = latex'}}
    % vertices
    \node[vertex] (a) at  (0,0) {5};
    \node[vertex] (f) at  (2,0) {6};
    \node[vertex] (b) at  (1,2) {4};
    \node[vertex] (c) at  (1,4) {3};
    \node[vertex] (d) at  (0,6) {1};
    \node[vertex] (e) at  (2,6) {2};
    %edges
    \draw[edge] (b) to (a);
    \draw[edge] (b) to (c);
    \draw[edge] (e) to (c);
    \draw[edge] (e) to (d);
    \draw[edge] (d) to (c);
    \draw[edge] (f) to (b);

\end{tikzpicture}
\caption{Type III}
\end{subfigure}
\begin{subfigure}[b]{.45\linewidth}
\begin{tikzpicture}   
    \tikzset{vertex/.style = {shape=circle,draw,minimum size=1.5em}}
    \tikzset{edge/.style = {->,> = latex'}}
    % vertices
    \node[vertex] (a) at  (0,0) {5};
    \node[vertex] (f) at  (2,0) {6};
    \node[vertex] (b) at  (1,2) {4};
    \node[vertex] (c) at  (1,4) {3};
    \node[vertex] (d) at  (0,6) {1};
    \node[vertex] (e) at  (2,6) {2};
    %edges
    \draw[edge] (b) to (a);
    \draw[edge] (b) to (c);
    \draw[edge] (e) to (c);
    \draw[edge] (e) to (d);
    \draw[edge] (d) to (c);
    \draw[edge] (f) to (b);

\end{tikzpicture}
\caption{Type IV}
\end{subfigure}
\begin{subfigure}[b]{.45\linewidth}
\begin{tikzpicture}   
    \tikzset{vertex/.style = {shape=circle,draw,minimum size=1.5em}}
    \tikzset{edge/.style = {->,> = latex'}}
    % vertices
    \node[vertex] (a) at  (0,0) {5};
    \node[vertex] (f) at  (2,0) {6};
    \node[vertex] (b) at  (1,2) {4};
    \node[vertex] (c) at  (1,4) {3};
    \node[vertex] (d) at  (0,6) {1};
    \node[vertex] (e) at  (2,6) {2};
    %edges
    \draw[edge] (b) to (a);
    \draw[edge] (b) to (c);
    \draw[edge] (e) to (c);
    \draw[edge] (e) to (d);
    \draw[edge] (d) to (c);
    \draw[edge] (f) to (b);

\end{tikzpicture}
\caption{Type V}
\end{subfigure}
\caption{Types of Graphs}
\label{fig:pivottypes}
\end{figure}

输出

相关内容