Figures & Diagrams
Inserting Images
How to include figures, control size and placement, and use subfigures.
Basic figure
\begin{figure}[t]
\centering
\includegraphics[width=0.8\linewidth]{figures/my_plot.png}
\caption{A caption describing the figure.}
\label{fig:myplot}
\end{figure}Placement specifiers
| Specifier | Meaning |
|---|---|
[t] | Top of the page (recommended for papers) |
[b] | Bottom of the page |
[h] | Here (approximately where it appears in source) |
[H] | Exactly here (requires float package) |
[!t] | Force top, overriding LaTeX's spacing rules |
Most conference templates prefer [t] or [htbp].
Controlling size
\includegraphics[width=0.8\linewidth]{...} % 80% of text width
\includegraphics[width=5cm]{...} % fixed width
\includegraphics[height=4cm]{...} % fixed height
\includegraphics[scale=0.5]{...} % 50% of original sizeTwo figures side by side
\begin{figure}[t]
\centering
\begin{subfigure}{0.48\linewidth}
\includegraphics[width=\linewidth]{figures/fig_a.png}
\caption{First result.}
\label{fig:a}
\end{subfigure}
\hfill
\begin{subfigure}{0.48\linewidth}
\includegraphics[width=\linewidth]{figures/fig_b.png}
\caption{Second result.}
\label{fig:b}
\end{subfigure}
\caption{Comparison of results.}
\label{fig:comparison}
\end{figure}Requires \usepackage{subcaption} in preamble.
Referencing figures
As shown in Figure~\ref{fig:myplot}, the accuracy improves...Always use ~ before \ref to prevent a line break between "Figure" and the number.
Supported formats
| Format | Notes |
|---|---|
.png | Best for screenshots, rasterized plots |
.pdf | Best for vector graphics (TikZ, matplotlib PDF output) |
.eps | Legacy vector format — convert to PDF when possible |
.jpg | Photos — avoid for plots (compression artifacts) |
.svg | Requires svg package; convert to PDF for reliability |