Figures & Diagrams
TikZ Diagrams
Create diagrams natively in LaTeX using TikZ, pgfplots, and smartdiagram.
For diagrams that need to match your document's fonts and style exactly, use TikZ — LaTeX's built-in vector graphics system. The AI can generate TikZ code directly into your .tex file.
Available TikZ packages
| Package | Use |
|---|---|
tikz | General-purpose drawing |
pgfplots | Data plots (line, bar, scatter) with LaTeX fonts |
tikz-cd | Commutative diagrams (mathematics) |
smartdiagram | Ready-made diagram styles (flow, cycle, priority) |
circuitikz | Electronic circuit diagrams |
forest | Tree structures and parse trees |
neuralnetwork | Neural network architecture diagrams |
Requesting a TikZ diagram
Ask the AI in chat:
Create a TikZ flowchart showing: Input → Preprocessing → Model → Output.
Use rounded boxes and arrows. The diagram should be 8cm wide.The AI writes the TikZ code and inserts it into main.tex.
Example: pgfplots chart
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{tikzpicture}
\begin{axis}[
xlabel={Epoch}, ylabel={Loss},
legend pos=north east,
width=8cm, height=5cm,
]
\addplot coordinates {(1,0.95)(20,0.5)(50,0.25)(100,0.12)};
\addlegendentry{Training}
\addplot coordinates {(1,0.98)(20,0.55)(50,0.32)(100,0.21)};
\addlegendentry{Validation}
\end{axis}
\end{tikzpicture}When to use TikZ vs Python
| Scenario | Use |
|---|---|
| Diagram needs to match document fonts | TikZ |
| Data plot with many data points | Python (matplotlib) |
| Architecture / flow diagram | Either — TikZ for simple, Python/Graphviz for complex |
| Statistical chart (violin, box, heatmap) | Python (seaborn) |
| Neural network diagram | TikZ (neuralnetwork package) |
| Circuit diagram | TikZ (circuitikz) |