This is the documentation to Matplotlib for C++, a C++ wrapper for Python’s matplotlib (MPL) plotting library.

The code is organised in this GitHub repository, which is a fork of that repository.


This is: A lightweight, easy-to-use interface to create stylish and clean plots in C++ using basic MPL commands.

This is not: A translation of MPL to C++.

How to use this documentation

Function definitions

This is the core of the documentation, located at The Docs. To find the definition and explanations for a special command use the search field on the top left, since this page can get a bit lengthy.

Bear in mind, that matplotlibcpp is a C++ wrapper to the Python library MPL. Thus, to learn more about the functions that are eventually called the matplotlib documentation might be useful. Most functions have a link to the MPL function they call, marked with the MPL logo:

Clicking here leads to the corresponding function definition in MPL

However, the function signatures might differ and Matplotlib for C++ does not support the full functionality of MPL. The purpose is providing an easy-to-use wrapper to MPL in C++, not to fully translate the library.

Help for compiling

The section Compiling a program explains the compilations of a program using the matplotlibcpp.h header.

Style of a line

Refer The style of a line to tune the appearance of the lines you plot.

Frequent problems

Frequent problems lists typical problems with Matplotlib for C++ and (hopefully) how to resolve them.


Criticism (preferably constructive), ideas and contributions are welcome! For contact, see Questions.