Graphs & Diagrams
Graphs & Diagrams
There is no %[…] operator
An earlier draft of this page described a %[bar, 10, 20, 30] chart function.
It was never implemented and is not planned in that form. What follows is
what actually works today.
Diagrams: Mermaid
Flowcharts, sequence diagrams, state machines, Gantt charts, ER diagrams — write
them as a fenced code block tagged mermaid and Tachyonn renders the diagram
instead of the code:
```mermaid
flowchart LR
A[Editor] --> B[Parser]
B --> C[SlideDeck IR]
C --> D[Renderer]
```It runs client-side and offline; the library is bundled. See
Other Components for the
details.
Mermaid also covers a couple of genuine chart types — pie and xychart — which
may be enough when you just need to show three proportions.
Charts: draw them elsewhere
For a real plot — error bars, log axes, a fitted curve — make it in the tool that
owns the data (matplotlib, R, Julia, a spreadsheet), export it, and place it as
an image:
![<c, w=70%> figures/decay-curve.svg, Exponential decay of the signal]Export SVG where you can: it stays vector in the PDF, so it's sharp on a
projector and in print, and it costs less than a raster of the same quality.
This is a deliberate division of labour. A plotting DSL inside .tac would
always be a worse matplotlib, and it would put the data in the slide file rather
than next to the analysis that produced it.
Tables from data
If the answer is numbers rather than a picture, a table can read straight from a
CSV, so the slide follows the file:
|[<f=results.csv>, s, b, c]See Tables and
Composition & Scripting.