> ## Documentation Index
> Fetch the complete documentation index at: https://resources.latex-cloud-studio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Plotting with pgfplots in LaTeX

> Create publication-quality plots in LaTeX using pgfplots for line charts, scatter plots, and axis customization.

`pgfplots` lets you generate vector plots directly in LaTeX.

## Basic Plot

```latex pgfplots-basic.tex theme={null}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}

\begin{tikzpicture}
  \begin{axis}[xlabel={$x$},ylabel={$f(x)$},grid=major]
    \addplot[blue,thick,domain=0:5,samples=100]{x^2};
  \end{axis}
\end{tikzpicture}
```

## Plot from Data Table

```latex pgfplots-table.tex theme={null}
\begin{axis}[xlabel=Epoch,ylabel=Accuracy]
  \addplot table[row sep=\\]{
  1 0.61\\
  2 0.68\\
  3 0.74\\
  4 0.79\\
  };
\end{axis}
```

## Related Pages

* [Inserting images](/learn/latex/figures/inserting-images)
* [TikZ diagrams](/learn/latex/how-to/tikz-diagrams)
