Skip to content

TikZ nodes, arrows and diagrams

Place each box with \node[draw] (name) {text};, position the next ones with the positioning library (right=of name), and connect them with \draw[->] (a) -- (b);.

Nodes

A node is a piece of text at a point, optionally with a frame. draw gives it an outline, fill a background, and circle or ellipse a round shape (rectangle is the default). A name in parentheses lets you refer to the node later.

Nodes with shapes, fills and sizes

LaTeXPreamble: \usepackage{tikz}Open in editor (opens in a new tab)
\begin{tikzpicture}
  \node[draw] (a) at (0,0) {plain box};
  \node[draw, rounded corners, fill=blue!10] (b) at (3,0) {rounded};
  \node[draw, circle, fill=yellow!40] (c) at (5.5,0) {44};
  \node[draw, ellipse] (d) at (8,0) {ellipse};
  \node[draw, minimum width=2.5cm, minimum height=1cm] at (1,-1.6) {fixed size};
  \node[draw, text width=2.6cm, align=center] at (5,-1.6) {text that wraps onto two lines};
\end{tikzpicture}

Arrows between nodes

\draw[->] (a) -- (b); draws an arrow from node a to node b. The line starts and ends at the node borders, not at their centres. -| and |- draw right-angled connections.

A small flowchart with the positioning library

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning, arrows.meta}
\begin{document}
\begin{tikzpicture}[
    node distance=1.2cm and 1.6cm,
    box/.style={draw, rounded corners, fill=blue!8, minimum width=2.2cm, minimum height=0.8cm},
    >={Stealth},
  ]
  \node[box] (in) {Read data};
  \node[box, right=of in] (clean) {Clean};
  \node[box, right=of clean] (fit) {Fit model};
  \node[draw, circle, below=of clean] (ok) {OK?};
  \draw[->] (in) -- (clean);
  \draw[->] (clean) -- (fit);
  \draw[->] (fit) |- (ok);
  \draw[->] (ok) -| node[pos=0.75, left] {no} (in);
\end{tikzpicture}
\end{document}

right=of in puts the node to the right of in, separated by node distance. The other directions are left, above, below and the diagonals such as above right. right=2cm of in sets the distance for one node.

Labels on arrows and nodes

A node written in the middle of a path labels it. above, below, left, right set the side, and midway, near start, near end or pos=0.3 the position along the path. label=below:text adds a label to a node.

A state diagram with curved, labelled edges

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning, arrows.meta}
\begin{document}
\begin{tikzpicture}[state/.style={draw, circle, minimum size=1cm}, >={Stealth}, node distance=2.4cm]
  \node[state, label=below:start] (s0) {$q_0$};
  \node[state, right=of s0] (s1) {$q_1$};
  \node[state, right=of s1, fill=green!15] (s2) {$q_2$};
  \draw[->] (s0) to[bend left] node[above] {$a$} (s1);
  \draw[->] (s1) to[bend left] node[below] {$b$} (s0);
  \draw[->] (s1) -- node[above] {$a$} (s2);
\end{tikzpicture}
\end{document}

Anchors

Every node has anchors on its border: north, south, east, west and the corners such as north east. (box.north) is the point at the top centre of box.

Arrows from the anchors of a node

LaTeXPreamble: \usepackage{tikz}Open in editor (opens in a new tab)
\begin{tikzpicture}
  \node[draw, minimum width=3cm, minimum height=1cm] (box) {Server};
  \draw[->] (box.north) -- ++(0,0.7) node[above] {north};
  \draw[->] (box.east) -- ++(1,0) node[right] {east};
  \draw[->] (box.south west) -- ++(-0.6,-0.6) node[below left] {south west};
  \node[anchor=west] at (box.south east) {\small (anchor=west)};
\end{tikzpicture}

anchor=west on a node places the node so that its west anchor sits at the given point.

Arrow tips

OptionTipIn Scissor LaTeX
->, <-, <->the default TikZ tipWorks
-stealth, -latexthe classic stealth and LaTeX tipsWorks
-{Stealth}, -{Latex} (arrows.meta)the newer tipsWorks
|-|a bar at each endWorks
>={Stealth} on the picturethe tip used by ->Works
arrow tip options such as -{Stealth[length=3mm]}sizes and shapes of the tipPartly: the tip is drawn in its default size

Tip sizes are close to TikZ, not identical.

What is not supported

These features compile in a TeX installation but not here. Most are reported in the Problems tab.

FeatureWhat happens in Scissor LaTeXWhat to write instead
\matrix (and matrix of nodes)The whole picture becomes a dashed box with a messagePlace the nodes with at (x,y) or positioning
\picThe whole picture becomes a dashed box with a messageRepeat the drawing in a scope with shift
decorations (decorate, decoration=...)Ignored with a message; the path is drawn plainA plain or dashed path
node shapes from shapes.geometric (diamond, trapezium ...)Drawn as a rectangle, with a messagerectangle, circle or ellipse
double linesIgnored with a messageTwo nodes or paths
to[loop above] (a loop on one node)No loop is drawn and no message is shown; its label sits on the nodeAn arc or a .. controls .. curve from the node's border
pin=The pin text is shown, without the pin linelabel=
pos= on a -| or |- pathThe label is placed along the second leg only, so pos=0.25 lands near the cornerLabel the second leg with pos=0.75, or split the path in two
tikz-cd, circuitikz, forestThe picture is left out, with a messageSimple TikZ, or an image

\matrix becomes a placeholder

LaTeXPreamble: \usepackage{tikz}Open in editor (opens in a new tab)
\begin{tikzpicture}
  \matrix[draw] {
    \node {a}; & \node {b}; \\
    \node {c}; & \node {d}; \\
  };
\end{tikzpicture}

Problems tab: \matrix in a picture is not supported yet

A diamond node is drawn as a rectangle

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
  \node[draw, diamond] at (0,0) {Yes?};
  \node[draw, ellipse] at (2.5,0) {ellipse works};
\end{tikzpicture}
\end{document}

Problems tab: TikZ node option 'diamond' is not supported yet

The TikZ manual (in the PGF package) covers nodes, the positioning library and arrow tips: ctan.org/pkg/pgf. For shapes and paths, see drawings with TikZ.

See also TikZ basics, TikZ and Figures and images.

Questions and answers

How do I draw a flowchart in LaTeX?

Use TikZ nodes with draw for the boxes, the positioning library (right=of a, below=of b) to place them, and \draw[->] (a) -- (b); for the arrows.

How do I put text on an arrow in TikZ?

Write a node in the middle of the path: \draw[->] (a) -- node[above] {text} (b);.

Does tikz-cd work in Scissor LaTeX?

Not yet. A tikzcd diagram is left out with a message. Draw simple diagrams with nodes and arrows instead.

Every example on this page is typeset by Scissor LaTeX when the site is built. Last updated 2026-11-06.