Matplotlib - Environment Setup

Matplotlib and its dependency packages are available in the form of wheel packages on the standard Python package repositories and can be installed on Windows, Linux as well as MacOS systems using the pip package manager.

pip3 install matplotlib

Incase Python 2.7 or 3.4 versions are not installed for all users, the Microsoft Visual C++ 2008 (64 bit or 32 bit forPython 2.7) or Microsoft Visual C++ 2010 (64 bit or 32 bit for Python 3.4) redistributable packages need to be installed.

If you are using Python 2.7 on a Mac, execute the following command −

xcode-select –install

Upon execution of the above command, the subprocess32 - a dependency, may be compiled.

On extremely old versions of Linux and Python 2.7, you may need to install the master version of subprocess32.

Matplotlib requires a large number of dependencies −

  • Python (>= 2.7 or >= 3.4)
  • NumPy
  • setuptools
  • dateutil
  • pyparsing
  • libpng
  • pytz
  • FreeType
  • cycler
  • six

Optionally, you can also install a number of packages to enable better user interface toolkits.

  • tk
  • PyQt4
  • PyQt5
  • pygtk
  • wxpython
  • pycairo
  • Tornado

For better support of animation output format and image file formats, LaTeX, etc., you can install the following −

  • _mpeg/avconv
  • ImageMagick
  • Pillow (>=2.0)
  • LaTeX and GhostScript (for rendering text with LaTeX).
  • LaTeX and GhostScript (for rendering text with LaTeX).
Kickstart Your Career

Get certified by completing the course

Get Started