Mpldock
A matplotlib backend that makes figures dockable.
Motivation
Work with something like this:
instead of that:
Features
- Trivial integration - it is enough to change a matplotlib backend
- Arrange figures into a convenient layout with drag and drop
- Integrate mainloop with ipython, jupyter, pycharm console (or run as a standalone application)
- Preserve a layout and user-modifier state (scale, grid, etc.) through consecutive runs
Installation
pip install mpldock
Usage
Example
The simplest example with layout persistence:
import matplotlib.pyplot as plt
from mpldock import persist_layout
plt.use('module://mpldock') # may use also "backend" in matplotlibrc or MPLBACKEND env var
persist_layout('1e2682b5-4408-42a6-ae97-3c11332a96fa')
plt.figure("some plot")
plt.plot([1, 5, 3])
plt.figure("another plot")
plt.plot([5, 0, 1])
plt.show()
Set a backend
Set a matplotlib backend to module://mpldock.backend. See this for more.
E.g.:
import matplotlib
matplotlib.use('module://mpldock.backend') # must be done before importing pyplot
import matplotlib.pyplot as plt
Or (does not work with jupyter):
import matplotlib.pyplot as plt
plt.switch_backend('module://mpldock.backend')
Also using a global configuration (like matplotlibrc file or MPLBACKEND environment variable) works but not in jupyter or pycharm console, since they hack around many things.
Integrate mainloop (if desired)
In a standalone application it is enough to use typical:
plt.show()
at the end of script, which starts a mainloop and blocks until the application is finished.
In an ipython or jupyter usually integration with qt is automatic, but in some versions or configurations you may need to activate it manually:
%gui qt5
Layout persistence
In order to preserve a layout between application runs, additional line must be added:
from mpldock import persist_layout
persist_layout('my_super_unique_identifier')
The layout is saved after closing a window or when done manually from a menu (Layout/Save). The string identifier
should be different for each application (scripts with the same identifier share the layout).
More
See examples for more.
Major dependencies
- Python >= 3.6
- PyQt5 (PySide, PyQt4 coming soon)
- Matplotlib
Metadata
Release files for mpldock 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mpldock-0.2.tar.gz | 11.9 kB | Without provenance | Details for mpldock-0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mpldock-0.2-py3-none-any.whl | Python 3 | none | any | Details for mpldock-0.2-py3-none-any.whl |
Total release size: 24.1 kB
Release files / mpldock-0.2.tar.gz
| Download URL | mpldock-0.2.tar.gz |
|---|---|
| Size | 11.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ccc8caaef5769369abb091d7791566790b7b2837a986ecdf7d386933c578ca69
|
|
BLAKE2b-256 checksum How to use checksums |
266e8da9e128ea980538f14a123b9f19d48b782088e94be7cd080eab5013acf8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Release files / mpldock-0.2-py3-none-any.whl
| Download URL | mpldock-0.2-py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0b5368c80869c255b73ae1d93a7aa7e93cbe0d014752f08fc8aa9f866129804c
|
|
BLAKE2b-256 checksum How to use checksums |
9c91a548f368eb1ba829f0e4df87902de2f768ba5c8de39446e0de2737564c54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Security for mpldock 0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.