https://github.com/scipp/mpltoolbox
Interactive tools for Matplotlib
https://github.com/scipp/mpltoolbox
matplotlib plotting python
Last synced: 3 months ago
JSON representation
Interactive tools for Matplotlib
- Host: GitHub
- URL: https://github.com/scipp/mpltoolbox
- Owner: scipp
- License: bsd-3-clause
- Created: 2022-07-05T14:47:09.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-10-13T12:30:39.000Z (5 months ago)
- Last Synced: 2025-10-21T19:57:35.801Z (4 months ago)
- Topics: matplotlib, plotting, python
- Language: Python
- Homepage: https://scipp.github.io/mpltoolbox/
- Size: 3.42 MB
- Stars: 8
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[](CODE_OF_CONDUCT.md)
[](https://pypi.python.org/pypi/mpltoolbox)
[](https://anaconda.org/conda-forge/mpltoolbox)
[](LICENSE)
[](https://mybinder.org/v2/gh/scipp/mpltoolbox/HEAD?labpath=docs%2Fdemo.ipynb)
# 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
```sh
python -m pip install mpltoolbox
```
## Examples
```Py
import matplotlib.pyplot as plt
import mpltoolbox as tbx
%matplotlib widget
```
### Points
```Py
fig, ax = plt.subplots()
ax.set_xlim(0, 100)
ax.set_ylim(0, 100)
points = tbx.Points(ax=ax)
```

### Lines
```Py
fig, ax = plt.subplots()
ax.set_xlim(0, 100)
ax.set_ylim(0, 100)
lines = tbx.Lines(ax=ax, n=2)
```

### Rectangles
```Py
fig, ax = plt.subplots()
ax.set_xlim(0, 100)
ax.set_ylim(0, 100)
rectangles = tbx.Rectangles(ax=ax)
```

### Ellipses
```Py
fig, ax = plt.subplots()
ax.set_xlim(0, 100)
ax.set_ylim(0, 100)
ellipses = tbx.Ellipses(ax=ax)
```
