How to Add Side-by-Side Plots in an IET LaTeX Template
At a glance
- 1. Check the template
Use the caption and subfigure packages supported by your specific IET template version.
- 2. Load subcaption
For a compatible class, load subcaption and avoid loading the older subfigure package too.
- 3. Build each panel
Put each plot in its own subfigure environment, with a caption and label.
- 4. Reference and adjust
Add the overall figure caption, then use figure or figure* depending on the desired width.
To put two plots in one IET-template figure, make each plot a subfigure and place both panels inside a single figure float. The subcaption package is a common way to give the panels individual captions and labels, but an IET class may already configure captions or provide its own subfigure support. Check the instructions supplied with your exact template before adding packages.
The example below is a complete, compilable demonstration using the standard article class. In an IET document, keep the class and settings from the supplied template, and transfer the relevant package declarations and figure body only if they are compatible with that class.
Minimal working example
This example draws two simple plots with PGFPlots. You can replace each tikzpicture with \includegraphics if your plots are separate image files.
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usepackage{subcaption}
\begin{document}
\begin{figure}[tbp]
\centering
\begin{subfigure}[t]{0.48\linewidth}
\centering
\begin{tikzpicture}
\begin{axis}[
width=\linewidth,
xlabel={$x$},
ylabel={$y$},
title={Linear plot}
]
\addplot coordinates {(0,0) (1,1) (2,2) (3,3)};
\end{axis}
\end{tikzpicture}
\caption{A linear trend}
\label{fig:linear}
\end{subfigure}\hfill
\begin{subfigure}[t]{0.48\linewidth}
\centering
\begin{tikzpicture}
\begin{axis}[
width=\linewidth,
xlabel={$x$},
ylabel={$y$},
title={Quadratic plot}
]
\addplot coordinates {(0,0) (1,1) (2,4) (3,9)};
\end{axis}
\end{tikzpicture}
\caption{A quadratic trend}
\label{fig:quadratic}
\end{subfigure}
\caption{Two example plots.}
\label{fig:plots}
\end{figure}
See Figure~\ref{fig:plots}; the left panel is Figure~\ref{fig:linear}
and the right panel is Figure~\ref{fig:quadratic}.
\end{document}
The panel widths add to less than \linewidth, leaving room for \hfill to separate them. Each subfigure has its own caption and label; the final caption and label belong to the whole figure. Put each \label after the caption it should refer to. LaTeX may need more than one compilation to update references.
Adapting the code to an IET template
Retain the template’s \documentclass, required packages, and prescribed caption settings. If its documentation permits subcaption, add \usepackage{subcaption} in the preamble and use the figure body shown above. Do not load both subcaption and the older subfigure package: they provide overlapping functionality and can conflict. Avoid adding a second caption-formatting package unless the template explicitly calls for it.
If the template reports a caption-related error, first check which caption or subfigure packages it already loads and consult its documentation. The issue may be a class-package incompatibility rather than an error in the plot code. Do not remove or replace template settings blindly, especially for a journal submission; use the mechanism recommended for that template version.
For image files instead of PGFPlots, replace each tikzpicture block with an image command, for example:
\includegraphics[width=\linewidth]{plot-a.pdf}
Add \usepackage{graphicx} only if the template does not already load it. Keep the image width at or below the width of its subfigure, and use file names that match the uploaded plot files.
Choosing the float width
In a one-column layout, or when the panels fit within one column, use figure. In a two-column layout, use figure* when the combined plots need the full page width. Replace both \begin{figure} and \end{figure} with their starred forms; the starred float’s placement is controlled by the document class and may be more limited than an ordinary figure. Avoid forcing placement with [H] unless the template and journal instructions allow it.
If the template does not support panel captions, a fallback is to place plots in separate minipage environments and label them manually in the text. That can align images, but it does not provide the same automatic panel numbering or references as subcaption.
Common mistakes
- Loading conflicting packages: Do not combine
subcaptionwith the obsoletesubfigurepackage. Check the class documentation before loading either. - Making panels too wide: Two panels each set to
0.5\linewidthcan overrun the line once spacing is included. Use slightly smaller widths, such as0.48\linewidth, and leave separation room. - Putting labels too early: A label before its caption may pick up the wrong number. Place the panel label after its subcaption and the main label after the overall caption.
- Expecting a float to stay exactly in place:
figureandfigure*are floats. LaTeX may move them to satisfy page-layout rules; choose placement options consistent with the template rather than relying on forced positioning.
The key point is that the subfigure environments make the panels; the outer figure environment handles the shared caption and float placement. The IET class determines which caption package arrangement is acceptable.
References
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.