Our visual editor builds the tree branch by branch and generates the TikZ code. Ready presets (coin flip, urn, conditional, binomial), mouse-driven editing, math-mode labels. Compile PDF directly.
Any math teacher who has tried to drop a tree into an exam knows it: you need TikZ, you compute node coordinates, and you align them cleanly. Three frictions show up every time — those are what we fix.
Each node (root, branches, leaves) must be positioned. The wider the tree, the more you must spread the leaves to avoid label overlap.
Probabilities below, on top, or in the middle of each edge? Math mode for fractions? node[midway, above] on every edge gets repetitive.
Add a branch? All downstream coordinates shift. Change depth? Recompute the whole spacing.
Our tree editor starts from a preset (coin flip, urn, conditional, binomial) and lets you add, remove, or edit branches with the mouse. The TikZ code is generated and updated in real time.
Coin flip, urn (2 draws), conditional probability, binomial (n=3) — pick a preset and customize. You're 90% of the way there.
Click to add or remove branches. Drag to reorder. Math-mode labels (KaTeX) with instant preview. Label position (above, on, below) in one click.
Generated code uses standard TikZ conventions (\node, \draw, automatic spacing). Copy it or compile directly in the browser.
Coin flip, urn, conditional, binomial — or free structure 2×2, 3×2, 2×3.
Rename nodes (A, B, R, G…), change probabilities (1/2, 0.3, p, 1-p…), adjust label positions.
Copy the tikzpicture block, compile the PDF directly in the browser, or save to your Sarmate drive.
\begin{tikzpicture}[level distance=20mm, sibling distance=22mm]
\node {} child { node {P} edge from parent node[above left] {$\frac{1}{2}$} } child { node {F} edge from parent node[above right] {$\frac{1}{2}$} };
\end{tikzpicture}\begin{tikzpicture}[grow=right, level distance=22mm, sibling distance=14mm, edge from parent/.style={draw,->}]
\node {} child { node {R} child { node {R} edge from parent node[above] {$\frac{2}{4}$} } child { node {V} edge from parent node[below] {$\frac{2}{4}$} } edge from parent node[above] {$\frac{3}{5}$} } child { node {V} child { node {R} edge from parent node[above] {$\frac{3}{4}$} } child { node {V} edge from parent node[below] {$\frac{1}{4}$} } edge from parent node[below] {$\frac{2}{5}$} };
\end{tikzpicture}\begin{tikzpicture}[level distance=22mm, sibling distance=22mm]
\node {} child { node {A} child { node {B} edge from parent node[above left] {$P_A(B)$} } edge from parent node[above left] {$P(A)$} } child { node {\overline{A}} child { node {B} edge from parent node[above right] {$P_{\overline{A}}(B)$} } edge from parent node[above right] {$P(\overline{A})$} };
\end{tikzpicture}\begin{tikzpicture}[level distance=18mm, sibling distance=24mm]
\node {} child { node {S} child { node {S} child { node {S} } child { node {E} } } child { node {E} child { node {S} } child { node {E} } } } child { node {E} child { node {S} child { node {S} } child { node {E} } } child { node {E} child { node {S} } child { node {E} } } };
\end{tikzpicture}| By hand | With Sarmate.net | |
|---|---|---|
| Time for a 2×2 tree | 15 to 30 min | Under a minute |
| Coordinate computation | Manual, tedious | Automatic |
| Modify one branch | Recompute everything downstream | Auto re-adjust |
| Labels (\(\frac{1}{2}\), p, q…) | node[midway, above] per edge | Input field |
| Visual preview | Recompile every time | Real-time |
| Ready-to-use presets | Search the internet | 4 built-in presets |
\node for each node and \draw for edges — often loading \usetikzlibrary{positioning} for below=of, right=of, etc. Precise but verbose. Our editor does all that with the mouse and gives you ready-to-paste code.node. Math content goes between $…$ — e.g. node[midway, above] {$\frac{1}{2}$}. Our editor accepts 1/2 directly and converts it to \frac{1}{2}, or you can write the LaTeX formula directly.[midway, above], [midway, below], or [pos=0.5, sloped] (on the line). For a downward-right branch, above can visually clash — sometimes below is preferable. Our editor exposes the three choices through a menu, with instant preview.\begin{tikzpicture}[scale=0.8], reduce spacing with node distance=1cm, or orient the tree horizontally (left-to-right rather than top-to-bottom). For a very wide tree, \resizebox{\textwidth}{!}{...} around the tikzpicture caps the width at text width.node[midway] directives?Open the tree editor in one click. No signup for the demo.
Launch the tree editor now