Joy Shen29 downloadsDraw figures for algorithms, data structures and theoretical CS from short text: trees, graphs, automata, plots, Venn and sequence diagrams. Insert them as editable PNG or SVG.
Draw figures for algorithms, data structures and theoretical computer science from a few lines of text: arrays and DP tables, trees, graphs and automata, linked lists and hash tables, function plots, Venn diagrams, message sequences and timelines, in the clean style of textbooks such as Introduction to Algorithms (CLRS). Edit the text in a panel with a live preview, then insert the figure into your note as PNG or SVG. The source is stored inside the image, so you can reopen and change the figure at any time.



array, table, tree, graph, list / chains, plot, sets, seq, timeline, plus panels, arrows and text to combine them.link P[2] -> L[1] points from an array cell to a list node, a table cell to a frame, a B-tree leaf to the next.x_1, n^2, \frac{n}{2}, \alpha, \le, \vdash, \subseteq, \oplus, \hat{x}, NIL in small caps, all in Computer Modern. The fonts are built into the plugin, so the preview, PNG and SVG look the same on every machine.Run Figure Suite: New figure from the command palette or the ribbon, or right-click in the editor and choose Insert figure….
Pick a template (the first toolbar button), or type a figure:
tree
6 right=0
2 right=0
1
3
9 right=+1
_
10
Press Insert (or Mod+Enter). The figure is saved to your attachment folder and embedded at the cursor.
To change it later, hover over the image and click the pencil icon. You can also right-click the link and choose Edit figure, or run Edit figure at cursor.
Open Syntax help (the ? button in the panel) for the full reference with examples.
| Block | For |
|---|---|
array |
arrays, stacks and queues, sorting steps (pointers, braces, shaded ranges, arcs), counting sort, string matching, Turing machine tapes |
table |
DP tables with arrows (LCS, CYK), matrices, adjacency matrices, truth tables, transition tables, binary counters, radix sort |
tree |
BSTs, heaps, AVL and red-black trees (NIL sentinels), B-trees, rotations (subtree triangles), recursion trees, Huffman trees, disjoint-set forests, parse trees, game trees, tries |
graph |
directed, undirected and weighted graphs, BFS/DFS states, shortest paths, MSTs, flow networks, SCCs, DAGs, bipartite matchings, finite automata (DFA, NFA), Markov chains, Hasse diagrams, reduction gadgets, point sets |
list, chains |
singly and doubly linked lists; hash tables with chaining, adjacency lists, buckets |
plot |
growth of functions, asymptotic bounds (n₀), amortised cost bars, points |
sets |
Venn diagrams with shaded regions and elements, nested sets, complexity-class pictures |
seq |
protocol message sequences (TCP, two-phase commit), space-time diagrams (Lamport clocks) |
timeline |
interval scheduling, activity selection, deadlines, Gantt charts (CPU scheduling) |
link |
arrows from part of one block to part of another: pointers, page tables, B+-tree leaves |
panel, arrow, text |
(a) (b) (c) panels, labelled arrows between them, text |
By course, that covers the usual figures of data structures and algorithms, automata and formal languages, computability and complexity (machines, reductions), discrete math (relations, posets, sets, graphs), probability (Markov chains), networking (protocols), distributed systems (space-time diagrams) and operating systems (scheduling, page tables).
A figure is a list of blocks. A block header starts at the left margin; its body is indented. Lines like shade: … inside a body are directives. // starts a comment.
figure cols=2 // optional: options for the whole figure
panel (a) before // a captioned panel
array A
5 2 4 6 1 3
shade: 2 black // colour cells
arc: 2 -> 1 below
arrow "insert" // arrow to the next panel
panel (b) after
array A
2 5 4 6 1 3
x_1, a_{i,j}, v1 (shown as v₁), \infty, \lceil n/2 \rceil, \frac{a}{b}, \Gamma \vdash \phi, A \subseteq B, \hat{q}. Quote a label with spaces: "n - 1".5@red colours one cell or node. shade: 2..4 gray colours several. Names: white light shade gray dark black red pink blue lightblue green lightgreen yellow orange tan purple, or #hex.ptr: i=2 j=5, span: 1..3 {\le x}, bar: 3, arc: 2 -> 1, index=below, start=0.cols:, rows:, shade: (1,2), arrow: (2,2) -> (1,1), brackets for matrices._ is an empty slot, nil a NIL sentinel, [G M P] a B-tree node, "α" tri a subtree triangle.left= right= above= below= add notes next to a node; edge=, thick and dashed style the edge to the parent.level: adds a note to a whole level.a -> b 10, a -- b or a <-> b.(x,y)), shape or colour.layout=auto|layered|force|circle|grid|line|manual; dir=down|up|right|left for layered layouts.graph hasse with a < b < c draws a Hasse diagram: bottom-up, plain lines, and pairs implied by transitivity are left out, so you can write the whole order.group:, rank: and shade: work on nodes; bend=, loop= and swap shape edges.list L.head double with the keys in the body; chains T with a line like 1: k1 k4 for each slot.n \lg n, 2^n, \frac{n}{2} (label and style after it: n^2 "quadratic" dashed); x=1..8 y=0..64 xlabel=n; vline: 4 n_0, bars: 1 2 1 4, points: (1,2).shade: A&B-C gray (& | -, ~A or A'); in: A-B 1 2 writes elements in a region; layout=venn|nested|manual with (x,y) rx= ry= for your own ellipses; universe.C -> S "SYN" delay=1 (slanted when it takes time), --> for a reply, lost, A -> A self message, A * "crash" event; dir=right for space-time diagrams.a 0..3, a repeated name continues its row, d 9 "deadline" point event, mark: 5 t; gantt for a single row.link A[2] -> B[1] "label" dashed bend=20; references are A[i], T[r,c], L[k], H[k,j], G.node, T[key] or a whole block; name a block by its header name or id=.The in-app reference lists every option.
|width is added to inserted linksiTXt chunk) or SVG (<metadata>) it produces; turn off Embed source in images if you'd rather not keep it.\mathbb and \mathcal) fall back to the system serif font. That font isn't embedded in SVG exports, so an SVG may look different on another machine; PNG is unaffected.The plugin is plain JavaScript with no dependencies. build.py concatenates src/ into main.js, and tools/subset-fonts.js subsets the fonts into src/fontdata.js.
python3 build.py # build main.js and styles.css
node tests/test-engine.js # parser, labels, every template and help example, PNG/SVG round trips
| File | Purpose |
|---|---|
src/font.js |
TrueType reader (cmap, hmtx, glyf) |
src/mathtext.js |
mini TeX typesetter |
src/parse.js |
figure source parser and option checks |
src/blocks.js |
array, table, list, chains, text, arrow |
src/tree.js |
tidy tree layout |
src/graph.js |
graph layouts, edges, loops, groups |
src/links.js |
link arrows between blocks |
src/plot.js |
expression evaluator and plot |
src/seq.js, src/timeline.js, src/sets.js |
seq, timeline, sets |
src/compose.js |
panels and the final SVG |
src/export.js |
PNG rasterising, source embedding, clipboard |
src/panel.js |
the editor panel |
src/help.js |
the syntax reference |
src/main.js |
commands, menus, the edit button, settings |
MIT, see LICENSE. The bundled CMU Serif fonts (Computer Modern by Donald E. Knuth, converted by Andrey V. Panov) are licensed under the SIL Open Font License 1.1, see fonts/OFL.txt.