Skip to content

scipp/mpltoolbox

Contributor Covenant PyPI badge Anaconda-Server Badge License: BSD 3-Clause Binder

Mpltoolbox

About

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.

Installation

python -m 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

About

Interactive tools for Matplotlib

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages