TikZ graphics in LaTeX
| First picture | |
| Nodes and edges | |
| Plots with pgfplots | |
| Styles keep it consistent | |
| Externalize slow pictures |
First picture
TikZ draws vector graphics from code, so diagrams match the document fonts automatically. Load the package and open a picture:
\usepackage{tikz}
\begin{tikzpicture}
\draw (0,0) -- (2,1) -- (0,2) -- cycle;
\end{tikzpicture}
Nodes and edges
Most diagrams are boxes with arrows. Nodes place the boxes, edges connect them, and the arrows library supplies the tips:
\usetikzlibrary{arrows.meta}
\node (a) at (0,0) {Start};
\node (b) at (3,0) {End};
\draw[-{Stealth}] (a) -- (b);
Plots with pgfplots
For function plots and data charts use pgfplots on top of TikZ: axes, legends and grid come free, and the plot inherits the document style instead of looking pasted from a spreadsheet.
Styles keep it consistent
Define node and edge styles once in the preamble and reference them everywhere: ten diagrams stay visually identical, and a rebrand means editing three lines instead of thirty pictures. Name styles by meaning (process, decision, data), never by appearance (bluebox), or the names lie after the first redesign.
Externalize slow pictures
Complex pictures recompile on every run and eventually dominate build time. The external library compiles each tikzpicture once into a PDF and reuses it until the source changes — minutes back on every draft cycle for one preamble line.
| LaTeX | |
| TikZ graphics | |
| Beamer presentations | |
| All LaTeX symbols |