SciPy 2025

Dynamic Data with Matplotlib
07-09, 10:45–11:15 (US/Pacific), Ballroom

Matplotlib is already a favorite plotting library for creating static data visualizations in Python.
Here, we discuss the development of a new DataContainer interface and accompanying transformation pipeline which enable easier dynamic data visualization in Matplotlib.
This improves the experience of plotting pure functions, automatically recomputing when you pan and zoom.
Data containers can ingest data from a variety of sources, including structured data such as Pandas Dataframes or Xarrays, up to live updating data from web services or databases.
The flexible transformation pipeline allows for control over how your data is encoded into a plot.


Starting with a brief overview of the new data model for the future of Matplotlib and the transformation pipeline between data and visualization that uses this data model, the majority of the talk will focus on how these tools enable dynamic plotting with Matplotlib.

Matplotlib is designed around static Numpy arrays, which makes plotting dynamic data cumbersome.
Even an apparently simple task of plotting a pure function is not as easy as you may think.
Typically, you select a range and resolution for your x-axis values (and y-axis for a 2D function) and precompute the outputs.
However, once plotted you can pan outside of your range or zoom in to see the discretization of the originally chosen computed values.
The DataContainer specification allows for easy plotting of pure functions, which automatically adapt to viewport.
This allows infinite panning and zooming, without precomputing large datasets.

These same ideas can be applied to other dynamic data sources, such as calls to databases or web services.

The flexible processing pipeline also provides avenues for powerful transformations between data and visualization.
For example, visualization space computation such as smart resampling of dense data or binning of data.

This work was conducted with a focus on improving the user experience of using Matplotlib.
Components are reusable and extensible, which allows us as maintainers to improve library cohesion by default, while opening the door to advanced users to customize their plots and apply domain specific data space transformations.
In particular, retaining structure information and associated information such as physical units has been a key usecase.

Eager Matplotlib users and maintainers of libraries that interact with Matplotlib have several avenues to contribute:

  • As simple as playing with it and seeing if it enables your data analysis
  • Creating data containers for varied input sources
  • Exploring domain data using the transform stack
  • Maybe even using these structures with alternative visualization libraries!

This work was funded by the NASA ROSES grant.
The code can be found at https://github.com/matplotlib/data-prototype, with rendered documentation at https://matplotlib.org/data-prototype/.

Kyle is a Research Software Engineer with Matplotlib under the NASA ROSES grant.

Kyle holds a PhD in Chemistry from the University of Wisconsin where he did nonlinear spectroscopy.