Master figure placement, image inclusion, and advanced graphics in LaTeX. Learn professional techniques for scientific illustrations, diagrams, and visual content management.
Visual content is crucial in academic and technical documents. Whether you’re including experimental results, creating diagrams, or presenting data visualizations, LaTeX provides powerful tools for managing figures and graphics. This comprehensive guide will transform you from a LaTeX figure novice to a graphics expert.
LaTeX treats figures as “floats”—elements that can move to optimize page layout. This sophisticated system ensures professional document appearance but requires understanding to master:
% Basic figure environment
\begin{figure}[placement specifiers]
% Figure content
\caption{Figure description}
\label{fig:unique-label}
\end{figure}
\begin{figure}[htbp]
% h - here (approximately at this position)
% t - top of page
% b - bottom of page
% p - separate page for floats
% ! - override LaTeX's internal parameters
% H - HERE (requires float package)
Pro tip: Use [htbp]
for most figures, allowing LaTeX maximum flexibility.
First, load the graphicx package:
\usepackage{graphicx}
% Optional: Set graphics path
\graphicspath{{images/}{figures/}{../assets/}}
Include images with:
\begin{figure}[htbp]
\centering
\includegraphics[width=0.8\textwidth]{experiment-results.png}
\caption{Experimental results showing quantum entanglement}
\label{fig:quantum-results}
\end{figure}
% Size control
\includegraphics[width=5cm]{image.jpg}
\includegraphics[height=3cm]{image.jpg}
\includegraphics[scale=0.5]{image.jpg}
% Maintain aspect ratio
\includegraphics[width=0.5\textwidth,keepaspectratio]{image.jpg}
% Rotation and clipping
\includegraphics[angle=90,origin=c]{image.jpg}
\includegraphics[trim=1cm 2cm 1cm 2cm,clip]{image.jpg}
% Advanced example
\includegraphics[
width=0.7\textwidth,
angle=15,
origin=c,
trim=0.5cm 0.5cm 0.5cm 0.5cm,
clip
]{complex-diagram.pdf}
% PDFLaTeX supports:
% - PDF (vector, preferred for diagrams)
% - PNG (raster, good for photos)
% - JPG/JPEG (raster, compressed photos)
% XeLaTeX/LuaLaTeX additionally support:
% - EPS (with conversion)
% - SVG (with svg package)
Using minipage environments:
\begin{figure}[htbp]
\centering
\begin{minipage}{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{before.png}
\caption{Before treatment}
\label{fig:before}
\end{minipage}
\hfill
\begin{minipage}{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{after.png}
\caption{After treatment}
\label{fig:after}
\end{minipage}
\caption{Comparison of results}
\label{fig:comparison}
\end{figure}
\usepackage{subcaption}
\begin{figure}[htbp]
\centering
\begin{subfigure}[b]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{fig1.png}
\caption{Initial state}
\label{fig:sub1}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{fig2.png}
\caption{Intermediate state}
\label{fig:sub2}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{fig3.png}
\caption{Final state}
\label{fig:sub3}
\end{subfigure}
\caption{Evolution of the system over time}
\label{fig:evolution}
\end{figure}
For complex arrangements:
\begin{figure}[htbp]
\centering
\begin{subfigure}[b]{0.45\textwidth}
\includegraphics[width=\textwidth]{topleft.png}
\caption{Dataset A}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\textwidth}
\includegraphics[width=\textwidth]{topright.png}
\caption{Dataset B}
\end{subfigure}
\vspace{0.5cm}
\begin{subfigure}[b]{0.45\textwidth}
\includegraphics[width=\textwidth]{bottomleft.png}
\caption{Dataset C}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\textwidth}
\includegraphics[width=\textwidth]{bottomright.png}
\caption{Dataset D}
\end{subfigure}
\caption{Comparison across multiple datasets}
\label{fig:grid-comparison}
\end{figure}
TikZ allows creating publication-quality diagrams directly in LaTeX:
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning}
\begin{figure}[htbp]
\centering
\begin{tikzpicture}[
box/.style={rectangle, draw, rounded corners,
minimum width=3cm, minimum height=1cm},
arrow/.style={->, thick}
]
% Nodes
\node[box] (input) {Input};
\node[box, right=of input] (process) {Process};
\node[box, right=of process] (output) {Output};
% Arrows
\draw[arrow] (input) -- (process);
\draw[arrow] (process) -- (output);
% Labels
\node[above=0.5cm of process] {System Overview};
\end{tikzpicture}
\caption{Simple system diagram}
\label{fig:system}
\end{figure}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{figure}[htbp]
\centering
\begin{tikzpicture}
\begin{axis}[
xlabel={Time (s)},
ylabel={Amplitude},
grid=major,
width=0.8\textwidth,
height=6cm,
legend pos=north east
]
% Plot from data
\addplot[blue, thick] coordinates {
(0,0) (1,2) (2,3) (3,3.5) (4,3.8) (5,4)
};
\addlegendentry{Experimental}
% Plot from function
\addplot[red, dashed, domain=0:5, samples=100]
{4*(1-exp(-0.5*x))};
\addlegendentry{Theoretical}
\end{axis}
\end{tikzpicture}
\caption{Comparison of experimental and theoretical results}
\label{fig:plot-comparison}
\end{figure}
\usetikzlibrary{shapes.geometric, arrows.meta}
\begin{figure}[htbp]
\centering
\begin{tikzpicture}[
node distance=2cm,
startstop/.style={rectangle, rounded corners,
minimum width=3cm, minimum height=1cm,
text centered, draw=black, fill=red!30},
process/.style={rectangle, minimum width=3cm,
minimum height=1cm, text centered,
draw=black, fill=orange!30},
decision/.style={diamond, minimum width=3cm,
minimum height=1cm, text centered,
draw=black, fill=green!30},
arrow/.style={thick,->,>=stealth}
]
\node[startstop] (start) {Start};
\node[process, below of=start] (init) {Initialize};
\node[decision, below of=init] (decide) {Condition?};
\node[process, below of=decide, xshift=-3cm] (yes) {Process A};
\node[process, below of=decide, xshift=3cm] (no) {Process B};
\node[startstop, below of=decide, yshift=-3cm] (stop) {End};
\draw[arrow] (start) -- (init);
\draw[arrow] (init) -- (decide);
\draw[arrow] (decide) -- node[left] {Yes} (yes);
\draw[arrow] (decide) -- node[right] {No} (no);
\draw[arrow] (yes) |- (stop);
\draw[arrow] (no) |- (stop);
\end{tikzpicture}
\caption{Algorithm flowchart}
\label{fig:flowchart}
\end{figure}
\usepackage{wrapfig}
\begin{wrapfigure}{r}{0.4\textwidth}
\centering
\includegraphics[width=0.35\textwidth]{molecule.png}
\caption{Molecular structure}
\label{fig:molecule}
\end{wrapfigure}
This text will wrap around the figure. The wrapfigure environment
is particularly useful for small figures that don't need the full
text width. Continue writing your paragraph here...
\begin{figure*}[htbp]
\centering
\includegraphics[width=\textwidth]{panoramic-view.png}
\caption{Full-width figure spanning both columns}
\label{fig:fullwidth}
\end{figure*}
\usepackage{rotating}
\begin{sidewaysfigure}
\centering
\includegraphics[width=\textwidth]{wide-table.png}
\caption{Rotated figure for landscape orientation}
\label{fig:landscape}
\end{sidewaysfigure}
% Print quality: 300 DPI minimum
% Screen viewing: 150 DPI acceptable
% Calculate required pixel dimensions:
% Width in inches × DPI = pixel width
% Example: 6 inches × 300 DPI = 1800 pixels wide
% Use vector formats (PDF, EPS) for:
% - Diagrams
% - Charts
% - Line drawings
% - Text-heavy graphics
% Use raster formats (PNG, JPG) for:
% - Photographs
% - Screenshots
% - Complex gradients
% - Scanned images
% Converting formats:
% inkscape input.svg --export-pdf=output.pdf
% convert input.png output.pdf
\usepackage{xcolor}
% Define custom colors for consistency
\definecolor{primaryblue}{RGB}{0,102,204}
\definecolor{secondaryred}{RGB}{204,0,0}
\definecolor{accentgreen}{RGB}{0,153,0}
% Use in figures
\begin{tikzpicture}
\draw[color=primaryblue, thick] (0,0) -- (2,2);
\fill[color=secondaryred] (1,1) circle (0.1);
\end{tikzpicture}
When using inscrive.io for collaborative LaTeX editing, figure management becomes seamless:
% Organize figures systematically
figures/
├── chapter1/
│ ├── experiment-setup.png
│ └── results-graph.pdf
├── chapter2/
│ ├── algorithm-flow.tikz
│ └── comparison-table.png
└── shared/
├── logo.pdf
└── common-diagram.svg
% Include with clear naming
\includegraphics{figures/chapter1/experiment-setup}
Create reusable figure templates:
% Define custom figure environment
\newenvironment{resultfigure}[2]{
\begin{figure}[htbp]
\centering
\includegraphics[width=0.8\textwidth]{#1}
\caption{#2}
}{
\end{figure}
}
% Usage
\begin{resultfigure}{results.png}{Experimental outcomes}
\label{fig:results}
\end{resultfigure}
\usepackage{overpic}
\begin{figure}[htbp]
\centering
\begin{overpic}[width=0.8\textwidth,grid,tics=10]{background.jpg}
\put(20,70){\color{white}\Large\textbf{Label A}}
\put(60,30){\color{yellow}\Large$\rightarrow$}
\put(65,30){\color{yellow}\Large Important Feature}
\end{overpic}
\caption{Annotated experimental setup}
\label{fig:annotated}
\end{figure}
\documentclass{beamer}
\usepackage{animate}
\begin{frame}{Animated Results}
\begin{figure}
\animategraphics[loop,controls,width=0.8\textwidth]{10}
{frames/frame-}{001}{050}
\caption{Time evolution animation}
\end{figure}
\end{frame}
% Define switches
\newif\ifshowfigures
\showfigurestrue % or \showfiguresfalse
% Conditional inclusion
\ifshowfigures
\begin{figure}[htbp]
\includegraphics{detailed-analysis.png}
\caption{Detailed analysis (included in full version)}
\end{figure}
\fi
% Force figure placement
\usepackage{float}
\begin{figure}[H] % Capital H forces "HERE"
\includegraphics{urgent-figure.png}
\end{figure}
% Clear all pending floats
\clearpage % or \cleardoublepage for books
% Adjust float parameters
\setcounter{topnumber}{3}
\renewcommand{\topfraction}{0.9}
\renewcommand{\textfraction}{0.1}
% Debug missing figures
\usepackage[draft]{graphicx} % Shows frames with filenames
% Check file paths
\graphicspath{{./images/}{../figures/}{/absolute/path/}}
% List loaded files
\listfiles % In preamble
% Reduce image size on-the-fly
\includegraphics[width=5cm,draft]{huge-image.png}
% Use lower resolution for draft
\ifdraft
\graphicspath{{images/low-res/}}
\else
\graphicspath{{images/high-res/}}
\fi
\usepackage{accessibility}
\begin{figure}[htbp]
\centering
\includegraphics[alt={Graph showing exponential growth
from 0 to 100 over 5 years}]{growth-chart.png}
\caption{Company growth over time}
\label{fig:growth}
\end{figure}
% Colorblind-friendly palette
\definecolor{cb-blue}{RGB}{0,114,178}
\definecolor{cb-orange}{RGB}{230,159,0}
\definecolor{cb-green}{RGB}{0,158,115}
\definecolor{cb-red}{RGB}{204,121,167}
\definecolor{cb-purple}{RGB}{86,180,233}
% High contrast for readability
\definecolor{hc-black}{RGB}{0,0,0}
\definecolor{hc-white}{RGB}{255,255,255}
% Externalize TikZ graphics
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize[prefix=tikz-cache/]
% Compile once, reuse many times
\begin{tikzpicture}
% Complex diagram code
\end{tikzpicture}
# Convert all images to appropriate format
for img in *.png; do
convert "$img" -quality 90 "${img%.png}.jpg"
done
# Optimize PDFs
for pdf in *.pdf; do
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4
-dPDFSETTINGS=/printer -dNOPAUSE -dQUIET
-dBATCH -sOutputFile="opt-$pdf" "$pdf"
done
% Use relative sizes
\includegraphics[width=0.8\linewidth]{figure.png}
% Store source files
figures/
├── figure1.tex % TikZ source
├── figure1.pdf % Compiled output
├── data/
│ └── figure1.csv % Raw data
└── scripts/
└── generate.py % Generation script
% Document figure sources
\begin{figure}[htbp]
\includegraphics{results.png}
\caption[Short caption for list]{
Detailed caption.
Data source: experiment-2024-01-30.csv.
Generated using: matplotlib v3.5.1.
}
\label{fig:documented}
\end{figure}
Mastering LaTeX figures and graphics transforms your documents from text-heavy reports to visually engaging publications. Whether you’re including simple images or creating complex diagrams, LaTeX provides the tools for professional results.
Modern collaborative platforms like inscrive.io make figure management even more powerful with real-time preview, version control, and team collaboration features. Combined with LaTeX’s precise control, you have everything needed for publication-quality visual content.
Remember: great figures enhance understanding, poor figures create confusion. Invest time in creating clear, professional graphics—your readers will thank you.
Ready to create stunning figures in your LaTeX documents? Try inscrive.io for real-time collaborative editing with instant figure preview, drag-and-drop image upload, and AI-powered assistance for perfect figure placement.
Master figure placement, image inclusion, and advanced graphics in LaTeX. Learn professional techniques for scientific illustrations, diagrams, and visual content management.
Read in 24 minutesMaster word counting in LaTeX documents with texcount and other tools. Learn accurate counting methods for theses, papers, and reports including handling of citations, captions, and mathematics.
Read in 17 minutesMaster the art of creating professional CVs and resumes with LaTeX. Explore modern templates, formatting tips, and collaborative editing with inscrive.io for impressive job applications.
Read in 18 minutesLearn professional alignment techniques in LaTeX for text, equations, and complex mathematical expressions. Master the align environment and advanced formatting with practical examples.
Read in 20 minutesStay up to date with the roadmap progress, announcements and exclusive discounts feel free to sign up with your email.
We care about the protection of your data. Read our Privacy Policy.