Interactive figures and asynchronous programming
Matplotlib supports rich interactive figures by embedding figures into a GUI window. The basic interactions of panning and zooming in an Axes to inspect your data is available out-of-the-box. This is supported by a full mouse and keyboard event handling system that you can use to build sophisticated interactive graphs.
This guide is meant to be an introduction to the low-level details of how Matplotlib integration with a GUI event loop works. For a more practical introduction to the Matplotlib event API see event handling system, Interactive Tutorial, and Interactive Applications using Matplotlib.
GUI events
All GUI frameworks (Qt, Wx, Gtk, Tk, macOS, or web) have some method of
capturing user interactions and passing them back to the application, but
the exact details depend on the toolkit (for example callbacks in Tk or
the Signal / Slot framework in Qt). The Matplotlib encapsulate the details of the GUI frameworks and
provide a framework-independent interface to GUI events through Matplotlib's
. By connecting functions
to the event handling system (see ), you can
interactively respond to user actions in a GUI toolkit agnostic way.