TransWikia.com

How does one nicely arrange a collection of subfigures on a page?

TeX - LaTeX Asked by JoeBass on February 11, 2021

I have the following code that renders awkwardly on a page… Ideally I’d like it to fit on one page, but I’m new to Tikz and I’m trying to go by example. Is there some way to scale? Should I be doing this a different way?

begin{figure}
centering
begin{subfigure}[b]{.45linewidth}
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]{.45linewidth}
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]{.45linewidth}
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]{.45linewidth}
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]{.45linewidth}
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}

output

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP