Published in World News

Complete Guide to LaTeX Figures and Graphics: From Basic Images to Advanced Visualizations

Master figure placement, image inclusion, and advanced graphics in LaTeX. Learn professional techniques for scientific illustrations, diagrams, and visual content management.

By inscrive.io Jan 30, 2025, 1:00 PM

Complete Guide to LaTeX Figures and Graphics: From Basic Images to Advanced Visualizations

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.


Understanding LaTeX Figure Management

The Float System

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}

Placement Specifiers Explained

\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.


Including External Graphics

Basic Image Inclusion

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}

Advanced includegraphics Options

% 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}

Supported Image Formats

% 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)

Professional Figure Layouts

Side-by-Side Figures

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}

Subfigures with subcaption Package

\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}

Grid Layouts

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}

Creating Graphics with TikZ

Basic TikZ Diagrams

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}

Scientific Plots with pgfplots

\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}

Flow Charts and Diagrams

\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}

Managing Complex Figures

Wrapping Text Around Figures

\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...

Full-Width Figures in Two-Column Documents

\begin{figure*}[htbp]
    \centering
    \includegraphics[width=\textwidth]{panoramic-view.png}
    \caption{Full-width figure spanning both columns}
    \label{fig:fullwidth}
\end{figure*}

Landscape Figures

\usepackage{rotating}

\begin{sidewaysfigure}
    \centering
    \includegraphics[width=\textwidth]{wide-table.png}
    \caption{Rotated figure for landscape orientation}
    \label{fig:landscape}
\end{sidewaysfigure}

Optimizing Figure Quality

Resolution Guidelines

% 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

Vector vs Raster Graphics

% 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

Color Management

\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}

Collaborative Figure Management with inscrive.io

Real-Time Figure Preview

When using inscrive.io for collaborative LaTeX editing, figure management becomes seamless:

  1. Instant preview: See figures render in real-time as you code
  2. Drag-and-drop upload: Easy image file management
  3. Version control: Track changes to figures and captions
  4. Team annotations: Comment directly on figures
  5. GDPR-compliant storage: Secure handling of research images

Best Practices for Team Projects

% 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}

Figure Libraries and Templates

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}

Advanced Techniques

Overlaying Text on Images

\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}

Creating Figure Animations (Beamer)

\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}

Conditional Figure Inclusion

% 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

Troubleshooting Common Issues

Figure Placement Problems

% 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}

Missing Figures

% Debug missing figures
\usepackage[draft]{graphicx}  % Shows frames with filenames

% Check file paths
\graphicspath{{./images/}{../figures/}{/absolute/path/}}

% List loaded files
\listfiles  % In preamble

Memory Issues with Large Images

% 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

Figure Accessibility

Adding Alternative Text

\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}

Creating Accessible Color Schemes

% 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}

Performance Optimization

Efficient Figure Handling

% Externalize TikZ graphics
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize[prefix=tikz-cache/]

% Compile once, reuse many times
\begin{tikzpicture}
    % Complex diagram code
\end{tikzpicture}

Batch Processing

# 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

Best Practices Summary

Do’s

  • ✓ Use vector formats for diagrams
  • ✓ Include descriptive captions
  • ✓ Label all figures for referencing
  • ✓ Maintain consistent style
  • ✓ Optimize file sizes
  • ✓ Test figure placement

Don’ts

  • ✗ Use screenshots of text
  • ✗ Include figures without captions
  • ✗ Ignore aspect ratios
  • ✗ Use low-resolution images
  • ✗ Hardcode absolute paths
  • ✗ Forget alternative text

Future-Proofing Your Figures

Sustainable Practices

% 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

Documentation

% 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}

Conclusion

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.

Related articles

article banner

Complete Guide to LaTeX Figures and Graphics: From Basic Images to Advanced Visualizations

Master figure placement, image inclusion, and advanced graphics in LaTeX. Learn professional techniques for scientific illustrations, diagrams, and visual content management.

Read in 24 minutes
article banner

Word Count in LaTeX: Complete Guide to Document Statistics and Analysis

Master 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 minutes
article banner

Professional LaTeX CV Templates: Create Stunning Resumes That Stand Out

Master 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 minutes
article banner

Mastering LaTeX Alignment: From Text to Complex Mathematical Equations

Learn 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 minutes

Sign up for our newsletter

Stay 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.