Interactive tools for matplotlib


Keywords
matplotlib, plotting, python
License
BSD-3-Clause
Install
pip install mpltoolbox==24.5.0

Documentation

PyPI version Anaconda-Server Badge Documentation Status License: BSD 3-Clause Binder

mpltoolbox

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.

Documentation

The documentation for mpltoolbox can be found at https://mpltoolbox.readthedocs.io.

Installation

pip install mpltoolbox

Examples

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

Points

fig, ax = plt.subplots()
ax.set_xlim(0, 100)
ax.set_ylim(0, 100)

points = tbx.Points(ax=ax)

points

Lines

fig, ax = plt.subplots()
ax.set_xlim(0, 100)
ax.set_ylim(0, 100)

lines = tbx.Lines(ax=ax, n=2)

lines

Rectangles

fig, ax = plt.subplots()
ax.set_xlim(0, 100)
ax.set_ylim(0, 100)

rectangles = tbx.Rectangles(ax=ax)

rects

Ellipses

fig, ax = plt.subplots()
ax.set_xlim(0, 100)
ax.set_ylim(0, 100)

ellipses = tbx.Ellipses(ax=ax)

ellipses