Matplot++: A C++ Library for Scientific Data Visualization
Matplot++: A C++ Graphics Library for Data Visualization 📊🗾
At a glance
- What is it?
- Matplot++ is a C++ graphics library that brings interactive plotting, high-quality export, and a compact syntax similar to MATLAB's plot API to modern C++ projects. It supports dozens of plot categories, multiple backends, and several coding styles, making it the closest standalone option for C++ code that already uses Eigen, Armadillo, or standard vectors for numeric data.
- Who is it for?
- Matplot++ is the right choice for C++ projects that need publication-quality plots without shelling out to Python or embedding a UI framework. It is most useful in scientific computing contexts where the data already lives in C++ containers and the team wants a compact, expressive plotting API rather than a general-purpose rendering library.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Activity is slowing. The repository last received commits 6 months ago.
- What is it written in?
- Mainly C++, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 30, 2026, and from our analysis. They are not legal advice.
Editorial analysis
What Matplot++ Solves for C++ Data Work
Scientific C++ code regularly produces numeric results that need to be visualised: convergence curves, distribution histograms, geographical data, vector fields, or 3D surfaces. The typical options in C++ are either UI-dependent libraries that require linking against a windowing framework, or language bindings that call out to Python or R. The README describes Matplot++ as a graphics library that addresses both cases: it provides interactive plots and high-quality file export while staying within the C++ build system and avoiding a hard dependency on a specific UI toolkit through its generic backend support. The library offers a syntax that the README describes as consistent with similar libraries, which in practice means its function names and parameter conventions follow the same patterns as MATLAB's plotting functions, making it recognisable to anyone who has used MATLAB or matplotlib for scientific work.
Plot Categories and What They Cover
The README lists the supported plot categories through its table of contents: line plots, data distribution (histograms, box plots, scatter plots), discrete data (bar charts, Pareto charts, stem plots), geography (geoplot, geoscatter, geobubble, geodensityplot), polar plots, contour plots, vector fields, surfaces, graphs (network diagrams), and images. The gallery in the repository shows examples of each. Beyond basic chart types, the README lists annotation primitives including text, text with arrows, rectangles, filled polygons, ellipses, textboxes, arrows, and lines. Appearance controls include axis labels, grid settings, multi-panel layouts (multiplot), colormaps, camera positioning for 3D plots, figure and axes objects, line specifications, and clear-axes operations. Exporting plots supports both manual saving from the interactive window and programmatic saving to file from code, which matters for reproducible pipelines that generate figures without a display.
Integrating Matplot++ into a CMake Project
The README describes integration through three paths: CMake's FetchContent mechanism for fetching the source at configure time, package managers such as vcpkg and Conan for pre-built installation, and a direct install for cases where the library is already present on the system. The repository includes a CMakeLists.txt and CMakePresets.json at the root, and the examples directory contains its own CMakeLists.txt for building all the bundled examples. The documentation site at alandefreitas.github.io/matplotplusplus is the recommended starting point for CMake integration code, since the README points there for the quick start. The library supports multiple backends, which the README notes allows using the library without committing to a specific rendering dependency. The coding styles section of the README describes four options: member functions on figure or axes objects, free-standing functions, reactive figures that redraw automatically, and quiet figures that defer redraw until explicitly called, along with method chaining and range-based interfaces.
Backend Design and Its Practical Implications
Matplot++ supports generic backends rather than tying every installation to a single rendering engine. The README describes this as one of the design goals for scientific data visualization in C++. In practice, this means the same plotting code can produce output through different backends, which matters for headless environments such as a CI server where no display is available. The library's support for programmatic export allows figures to be written directly to image or vector files without requiring an interactive session. This combination of programmatic export and backend flexibility is the specific trade-off that makes Matplot++ suitable for pipelines where plots are generated as part of an automated build rather than explored interactively. The limitation is that backend selection and configuration is handled at the CMake level, and the README notes this in the 'Backends' and 'Motivation and Details' sections of the table of contents without giving a full treatment in the README text itself; the documentation site carries the details.
What Matplot++ Does Not Cover
Matplot++ is a 2D and 3D plotting library for scientific output, not a general-purpose graphics framework. It does not handle interactive GUI applications, event-driven user interfaces, or real-time rendering of rapidly updating data at game-engine frame rates. Teams building dashboards with clickable widgets, sliders, or custom interactions should look at a UI framework instead. The library's syntax resemblance to MATLAB is an asset when the team already knows MATLAB but can be a source of confusion for teams whose mental model comes from a different charting API, since the correspondence is not perfect and C++ type constraints change how some functions are called. The README does not document rollback procedures if a backend fails to initialise on a given platform, and the community forum linked in the README is the primary place for resolving environment-specific issues.
Maintenance, Releases, and Licence
The most recent release is v1.2.2, published on 2025-02-14. The last push to the repository was on 2026-04-02. The library is licensed under MIT, which permits use in commercial and proprietary projects without imposing licence obligations on the rest of the codebase. The repository includes a .clang-format file, a GitHub Actions CI configuration, and mkdocs.yml for the documentation site. The project has a community discussion forum linked from the README and a contributors list. The gap between the last release (February 2025) and the last push (April 2026) suggests ongoing work that has not yet reached a tagged release, though the README does not document what changes are pending.
Editorial conclusion
Matplot++ is the right choice for C++ projects that need publication-quality plots without shelling out to Python or embedding a UI framework. It is most useful in scientific computing contexts where the data already lives in C++ containers and the team wants a compact, expressive plotting API rather than a general-purpose rendering library. The last push was on 2026-04-02 and the most recent release is v1.2.2, dated 2025-02-14, so teams adopting it now should verify that open issues affecting their required plot types are addressed before depending on it in a CI pipeline.
Frequently asked questions
How do I use Matplot++ in a C++ project?
The README describes three integration paths: CMake FetchContent, package managers such as vcpkg or Conan, and a direct system install. The CMake integration details are in the documentation at alandefreitas.github.io/matplotplusplus. The examples/CMakeLists.txt in the repository shows how the bundled examples are built.
What is a good C++ plot library?
Matplot++ is designed specifically for scientific data visualization in C++ with a MATLAB-compatible API, interactive plots, and programmatic file export. It integrates via CMake and supports multiple backends, making it usable in both interactive and headless environments.
Does Matplot++ support exporting plots to image files from code?
Yes. The README describes both manual saving from the interactive window and programmatic saving to file from within the program. This allows figures to be generated as part of automated builds without a display present.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/alandefreitas-matplotplusplus)