Problem Description
This is a continuation of a question I had here: Numbering and captioning pgfplots/tikzpicture
Where We solved how to name Graphs in a specific way and in-turn generate a \listofgraphs at the beginning of the document.
When I follow that code, I can't seem to get 2 of my graphs to appear side by side. I assumed using a \subfigure environment would work but from what I tried, I could not get it to work. Another suggestion from @koleygr was: Try using \captionof{Graph}{Bla Bla} inside minipages next to each other. But this is where I got lost.
MWE
For simplicity I am just using the same graph twice:
\documentclass [a4paper,10pt,draft]{report}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{arrows}
\usepackage{pgfplots}
\pgfplotsset{compat=1.6}
\usepackage{newfloat}
\usepackage{caption}
\DeclareFloatingEnvironment[placement={!ht},name=Graph]{Graph}
\captionsetup[Graph]{}
\counterwithin{Graph}{chapter}
\begin{document}
\listofGraph
\section{Two graphs should be side by side}
\begin{Graph}[!ht]
\centering
\caption{glued in cables 1}
\label{graph: pull out results}
\begin{tikzpicture}[trim axis left, trim axis right]
\begin{axis}[
%title={Pull-out glue strength for blocks with glued in cables},
axis lines=box,
xlabel={Block Number},
ylabel={Failure Load (N)},
xmin=1, xmax=5,
ymin=0, ymax=9000,
xtick={},
ytick={},
ymajorgrids=true,
xmajorgrids=true,
grid style=dashed,
enlargelimits=true,
]
\addplot[red,mark=square,mark size=2.9pt]coordinates{(1,6507) (2,6009) (3,5936) (4,5843) (5,6234)
};\label{Blocks A}
\addplot[blue,mark=square,mark size=2.9pt]coordinates{(1,1966) (2,1577) (3,2052) (4,1869) (5,2122)
};\label{Blocks B}
\addplot[green,mark=square,mark size=2.9pt]coordinates{(1,8435) (2,8027) (3,7648) (4,7865) (5,8123)
};\label{Blocks C}
\addplot[magenta,mark=square,mark size=2.9pt]coordinates{(1,3266) (2,2894) (3,3024) (4,2976) (5,3234)
};\label{Blocks D}
\addplot[orange,mark=square,mark size=2.9pt]coordinates{(1,6324) (2,6879) (3,5796) (4,6432) (5,6183)
};\label{Blocks E}
\addplot[violet,mark=square,mark size=2.9pt]coordinates{(1,2509) (2,2136) (3,2768) (4,2346) (5,2465)
};\label{Blocks F}
\end{axis}
\end{tikzpicture}
\end{Graph}%
\hspace{3pt}
%
\begin{Graph}[!ht]
\centering
\caption{glued in cables 2}
\label{graph: pull out results}
\begin{tikzpicture}[trim axis left, trim axis right]
\begin{axis}[
%title={Pull-out glue strength for blocks with glued in cables},
axis lines=box,
xlabel={Block Number},
ylabel={Failure Load (N)},
xmin=1, xmax=5,
ymin=0, ymax=9000,
xtick={},
ytick={},
legend pos=outer north east,
ymajorgrids=true,
xmajorgrids=true,
grid style=dashed,
enlargelimits=true,
]
\addplot[red,mark=square,mark size=2.9pt]coordinates{(1,6507) (2,6009) (3,5936) (4,5843) (5,6234)
};\label{Blocks A}
\addplot[blue,mark=square,mark size=2.9pt]coordinates{(1,1966) (2,1577) (3,2052) (4,1869) (5,2122)
};\label{Blocks B}
\addplot[green,mark=square,mark size=2.9pt]coordinates{(1,8435) (2,8027) (3,7648) (4,7865) (5,8123)
};\label{Blocks C}
\addplot[magenta,mark=square,mark size=2.9pt]coordinates{(1,3266) (2,2894) (3,3024) (4,2976) (5,3234)
};\label{Blocks D}
\addplot[orange,mark=square,mark size=2.9pt]coordinates{(1,6324) (2,6879) (3,5796) (4,6432) (5,6183)
};\label{Blocks E}
\addplot[violet,mark=square,mark size=2.9pt]coordinates{(1,2509) (2,2136) (3,2768) (4,2346) (5,2465)
};\label{Blocks F}
\end{axis}
\end{tikzpicture}
\end{Graph}
\end{document}
This produces the following result:
Desired Output/Solution
Whereas I would like something like this:




subcaptionpackage. – Jasper Habicht Aug 17 '22 at 13:33\begin{minipage}{0.3\textwidth}does not solve that issue entirely. – Aaron Rhodes Aug 17 '22 at 13:52\begin{tikzpicture}. Thanks – Aaron Rhodes Aug 17 '22 at 13:55subcaptionpackage might not exactly be what you're after because then, bothsubGraphswould semantically belong to the sameGraph. I still placed an answer that shows how to use it. – Jasper Habicht Aug 17 '22 at 13:56