New approach to matplotlib example galleries

Recently, I’ve built a framework for generating Python documentation via notebooks: It’s called Plywood Gallery and can be used for creating cheat sheet like overviews of Python packages with image output.

I’ve made these following galleries as a showcase for matplotlib:

  1. Matplotlib Scalebar
  2. Functions (see also this twitter post)
  3. 2D Array
  4. 3D Array
  5. Matplotlib ImageGrid
  6. Matplotlib Hatch

Why might this be useful?
For example, this axis grid example from the matplotlib docs has 97 lines of code.
That’s not easy to access, in comparison to the ImageGrid gallery from the above listing. The example is broken down into 15 individual examples, each with about 17 lines of code. With this approach, I think that users can quickly get they are looking for.

Currently, plywood gallery is a stand-alone project which is pretty much work in progress, but at some point in future this could also become a sphinx plugin (issue here).

See also this post about plywood on the jupyter discourse.

2 Likes

I think this project is super cool. I also think it fits into something we’ve been discussing, which is the distinction between reference and example images. We don’t really currently distinguish between the two in the gallery, but @timhoffm has proposed a couple of things. I think we were thinking of using sphinx code folding for this and there’s also collapse — sphinx-toolbox 3.2.0 documentation

1 Like