Skip to main content

Dock matplotlib figures and other widgets.

Project description


A matplotlib backend that makes figures dockable.


Work with something like this: docked layout instead of that: windowed layout


  • 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


pip install mpldock



The simplest example with layout persistence:

import matplotlib.pyplot as plt
from mpldock import persist_layout


plt.figure("some plot")
plt.plot([1, 5, 3])
plt.figure("another plot")
plt.plot([5, 0, 1])

Set a backend

Set a matplotlib backend to module://mpldock.backend. See this for more.


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

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:

at the end of script, which starts a mainloop and blocks until the application is finished.

In an ipython or jupyter a gui magic may be used:

%gui qt5

Layout persistence

In order to preserve a layout between application runs, additional line must be added:

from mpldock import persist_layout

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).


See examples for more.

Major dependencies

  • Python >= 3.6
  • PyQt5 (PySide, PyQt4 coming soon)
  • Matplotlib

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mpldock-0.1.tar.gz (11.4 kB view hashes)

Uploaded source

Built Distribution

mpldock-0.1-py3-none-any.whl (11.9 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page