Plotting
Suppose we want to add some visualisations to our document? PlotLy is an extensive library with lots of options and examples. One of their examples shows how to make 3D surface plots. PlotLy loads a CSV file giving the result to a call-back function, putting the data in rows
The following snippet unpacks the data from rows
and puts it in a format that PlotLy understands:
«unpack-data»=
We can now define the data set:
And have a suitable layout:
«define-plot-layout»=
The final plot command is given the inject=
attribute, showing the result and the plotting boilerplate in a tabbed item.
To make sure PlotLy is loaded, you should add,
to the meta-data header of your markdown.
This functionality could potentially be extended to other languages that compile to Javascript.