Mpltoolbox - Interactive tools for Matplotlib

Mpltoolbox - Interactive tools for Matplotlib#

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 on-liner.

Installation#

You can install from pip using

pip install mpltoolbox

or from conda with

conda install -c conda-forge mpltoolbox

Example#

import matplotlib.pyplot as plt
import mpltoolbox as tbx
%matplotlib widget

fig, axes = plt.subplots(2, 2, figsize=(12, 8))
for ax in axes.flat:
    ax.set_xlim(0, 100)
    ax.set_ylim(0, 100)

points = tbx.Points(ax=axes[0, 0])
lines = tbx.Lines(ax=axes[1, 1])
rects = tbx.Rectangles(ax=axes[0, 1])
ells = tbx.Ellipses(ax=axes[1, 0])

points rectangles ellipses lines