Allows you to render plots directly from data specified inline in the page source. Similarly to math rendering, the plots are rendered to a SVG that’s embedded directly in the HTML markup.
Download the m/plots.py file, put it including the
m/ directory into one of your
PLUGIN_PATHS and add
package to your
PLUGINS += ['m.plots'] M_PLOTS_FONT = 'Source Sans Pro'
M_PLOTS_FONT to a font that matches your CSS theme (it’s Source Sans
Pro for builtin m.css themes), note that you
need to have the font installed on your system, otherwise it will fall back
to whatever system font it finds instead (for example DejaVu Sans) and the
output won’t look as expected. In addition you need the
Matplotlib library installed. Get it via
or your distribution package manager:
pip3 install matplotlib
The plugin produces SVG plots that make use of the CSS plot styling.
Currently the only supported plot type is a horizontal bar graph, denoted by
:labels: option contain value labels, one per line. You
can specify unit label using
:units:, particular values go into
:values: separated by whitespace, there should me as many values as
labels. Hovering over the bars will show the concrete value in a title.
It’s also optionally possible to add error bars using
configure bar colors using
:colors:. The colors correspond to m.css
color classes and you can either
use one color for all or one for each value, separated by whitespace. It’s
possible to add an extra line of labels using
:labels_extra:. Bar graph
height is calculated automatically based on amount of values, you can adjust
the bar height using
:bar_height:. Default value is