pandoc-plot 1.8.0

pandoc-plot is a pandoc filter to generate figures from code blocks in documents. This page is generated from Markdown using pandoc-plot, so you can get a sense of what is possible.

Supported toolkits

pandoc-plot currently supports the following plotting toolkits (installed separately):

Simple examples

Here’s the simplest way to create a figure in Markdown:

```{.matplotlib}
import numpy as np
import matplotlib.pyplot as plt

np.random.seed(23)

# Compute areas and colors
N = 150
r = 2 * np.random.rand(N)
theta = 2 * np.pi * np.random.rand(N)
area = 200 * r**2
colors = theta

fig = plt.figure()
ax = fig.add_subplot(111, projection='polar')
c = ax.scatter(theta, r, c=colors, s=area, cmap='hsv', alpha=0.75)
```

which renders like so:

 (Source code)

Interactive plots

pandoc-plot supports interactive plots for certain toolkits. Here’s an example using bokeh:

```{.python .bokeh format=html caption="Move around in the plot by using your mouse. This gallery example was modified from [here](https://docs.bokeh.org/en/latest/docs/gallery/hex_tile.html)."}
import numpy as np

from bokeh.plotting import figure
from bokeh.transform import linear_cmap
from bokeh.util.hex import hexbin

np.random.seed(23)

n = 50000
x = np.random.standard_normal(n)
y = np.random.standard_normal(n)

bins = hexbin(x, y, 0.1)

p = figure(title="Interactive plotting with Bokeh", tools="wheel_zoom,pan,reset", match_aspect=True, background_fill_color='#440154', width=550, height=550)

p.grid.visible = False

p.hex_tile(q="q", r="r", size=0.1, line_color=None, source=bins,
           fill_color=linear_cmap('counts', 'Viridis256', 0, max(bins.counts)))

```

Move around in the plot by using your mouse. This gallery example was modified from here. (Source code)