A header-only C++ plotting library that provides a simple API similar to Matlab and matplotlib.
matplotlib-cpp is a header-only C++ plotting library that wraps Python's matplotlib to provide a simple, familiar API for generating plots directly from C++ code. It solves the problem of synchronizing algorithm output with visualization by eliminating the need to write data to files and parse them in Python. Developers can create and save plots with just a few lines of C++ code, integrating seamlessly into existing workflows.
C++ developers, researchers, and engineers working on scientific computing, data analysis, or simulation projects who need to visualize results directly within their C++ applications without switching to Python.
It offers the simplest way to add high-quality plotting to C++ projects by leveraging matplotlib's robust rendering through a minimal, header-only interface. Unlike other C++ plotting libraries, it provides a familiar API for Matlab/matplotlib users and requires no external dependencies beyond Python and matplotlib.
Extremely simple yet powerful header-only C++ plotting library built on the popular matplotlib
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Integration is trivial with a single header file, as shown in the minimal example requiring no complex build steps beyond linking to Python.
The syntax closely mirrors Matlab and matplotlib, making it easy for users of those tools to adopt, as demonstrated by plot() and xlim() functions.
It leverages Python's matplotlib backend for rendering, ensuring publication-ready plots with support for various formats like PNG, as seen in save() examples.
Supports iterable data structures and callables for cleaner code, as illustrated in the modern example using lambda functions.
The README explicitly warns it is not thread-safe due to Python's interpreter limitations, requiring mutexes for concurrent access.
It mandates a working Python installation with development headers and libpython, adding setup complexity and potential version conflicts, especially on Windows or macOS.
Only a subset of matplotlib's features is wrapped; the TODO list admits missing elements like xlabel()/ylabel() and object-oriented design for multiple plots.
Compilation requires manual flags for Python paths and libraries, and platform-specific fixes are needed (e.g., for Anaconda on Windows or backends on macOS).