grid-strategy icon indicating copy to clipboard operation
grid-strategy copied to clipboard

Use matplotlib sphinx extensions to build documentation

Open pganssle opened this issue 5 years ago • 0 comments

We should have a few simple examples in the documentation, generated inline with the matplotlib plotting extensions for sphinx.

For example, we can use this to generate one of the main figures:

.. plot::

   import matplotlib.pyplot as plt
   from grid_strategy.strategies import SquareStrategy

   specs = SquareStrategy('center').get_grid(7)

   for i, spec in enumerate(specs):
      ax = plt.subplot(spec)

      ax.text(0.5, 0.5, f"Subplot: {i}", color='white',
             fontweight='bold', va="center", ha="center")
      ax.tick_params(axis='both', bottom=False, top=False, left=False,
                    right=False, labelbottom=False, labelleft=False)

      ax.patch.set_facecolor('#2E2E2E')

   plt.show()

pganssle avatar Feb 25 '19 21:02 pganssle