Mpltoolbox aims to provide some basic tools (that other libraries such as bokeh or plotly support) for drawing points, lines, rectangles, polygons on Matplotlib figures.
There are many interactive examples in the Matplotlib documentation pages, but the code snippets are often long and potentially not straightforward to maintain.
With mpltoolbox
, activating these tools should (hopefully) just be a one-liner.
The documentation for mpltoolbox
can be found at https://mpltoolbox.readthedocs.io.
pip install mpltoolbox
import matplotlib.pyplot as plt
import mpltoolbox as tbx
%matplotlib widget
fig, ax = plt.subplots()
ax.set_xlim(0, 100)
ax.set_ylim(0, 100)
points = tbx.Points(ax=ax)
fig, ax = plt.subplots()
ax.set_xlim(0, 100)
ax.set_ylim(0, 100)
lines = tbx.Lines(ax=ax, n=2)
fig, ax = plt.subplots()
ax.set_xlim(0, 100)
ax.set_ylim(0, 100)
rectangles = tbx.Rectangles(ax=ax)
fig, ax = plt.subplots()
ax.set_xlim(0, 100)
ax.set_ylim(0, 100)
ellipses = tbx.Ellipses(ax=ax)