matplotlib: Python 2D plotting library


From the Matplotlib website: matplotlib is a python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms. matplotlib can be used in python scripts, the python and ipython shell (ala matlab or mathematica), web application servers, and six graphical user interface toolkits.


The Matplotlib license - see Matplotlib only uses BSD compatible code, and its license is based on the PSF license. See the Open Source Initiative licenses page for details on individual licenses. Non-BSD compatible licenses (eg LGPL) are acceptable in matplotlib Toolkits. For a discussion of the motivations behind the licencing choice, see Licenses.

Upstream Contact

The matplotlib mailing lists: see


  • python

  • numpy

  • setuptools (>= 0.7)

  • freetype

  • patch (used in spkg-install)

  • dateutil

  • pyparsing

  • tornado

  • kiwisolver

Build Instructions/Changes

  • NOTE: To drastically cut down on spkg size, we delete the internal testing images. To do this, we repackage the tarball by removing the contents of lib/matplotlib/tests/baseline_images/*, this is done by the spkg-src script.

  • disable loading of Tests. Otherwise, raises an error because it can’t find the deleted files from src/lib/matplotlib/tests/baseline_images/*

  • NOTE: as of matplotlib-1.0.0 and Sage 4.6, Sage does not use $HOME/.matplotlib by default. Instead, it sets MPLCONFIGDIR to a subdirectory in $DOT_SAGE, see src/bin/sage-env



Version Information




# Trac #33642: Set lower bound for use of matplotlib color maps introduced in #33491,
# and to suppress deprecation warnings (
matplotlib >=3.5.1

Equivalent System Packages


$ conda install "matplotlib>=3.5.1"

macports: install the following packages: py-matplotlib


$ sudo zypper install python3-matplotlib


$ sudo xbps-install  python3-matplotlib


However, these system packages will not be used for building Sage because using Python site-packages is not supported by the Sage distribution; see trac ticket #29023