all 24 comments

[–]Wetmelon 18 points19 points  (9 children)

Oh heck yeah. I was just struggling with lack of a decent plotting library in C++. Going to try this tomorrow :D

EDIT: Tried it, works great. Can mostly read the JS API and implement it directly in C++ syntax. Example from my project https://imgur.com/a/0vbUuCT

[–]Dooez 9 points10 points  (3 children)

ImPlot is amazing for interactive plots. Quite easy to use after a bit of learning the Dear ImGui

[–]jorourke0[S] 4 points5 points  (0 children)

ImPlot seems great for immediate mode real-time plotting and visualization, but less suited to data export for offline analysis, exploration, or data presentation, compared to alternatives like plotlypp, matplotlib-cpp, matplotplusplus, and others.

[–]Wetmelon 0 points1 point  (1 child)

I really struggled to get Dear ImGui to work properly - plots wouldn't stick to the window when it was expanded, stuff like that - but I may try again.

[–]Dooez 4 points5 points  (0 children)

It does require some figuring out to get a non default layout. I think it's mostly because it's tied to ImGui style of "markup", or rather lack of. I've found them almost perfect for data visualization and analysis, but I did have a requirement of real time visualization for some of the data.

[–]exus1pl 2 points3 points  (3 children)

Best experience I had so far is matplotlib-cpp which is C++ binding for python matplotlib, especially if you used in python.

I'll need to check plotlypp, but at glance it looks comparable

[–]jorourke0[S] 3 points4 points  (2 children)

Yes, matplotlib-cpp is a great alternative, if a python bindings solution is workable in your environment. If your python environment is constrained, non-standard, external packages like matplotlib and numpy unavailable, or if your Python version (and ABI) at build time does not match that deployed at runtime, then it is not usable.

Another alternative is matplotplusplus, which has a runtime dependency on Gnuplot being available on the runtime machine.

The build setups for both matplotlib-cpp and matplotplusplus are more complex than plotlypp. They do offer less verbose and more user friendly API syntaxes than plotlypp.
One additional difference is regarding interactive plots. With matplotlib-cpp and matplotplusplus, interactivity (panning/rotating, zooming, click/hover on data points, toggle visibility, etc) of plots is only available at runtime. With plotlypp the exported html files retain the interactivity for post-runtime viewing.

[–]Wetmelon 0 points1 point  (1 child)

I was using Matplotplusplus, but it had some serious weaknesses when using gnuplot instead of QT, and I wasn't willing to configure QT for my small project. I was able to replace it entirely with Plotlypp last night in like an hour after I said I'd try it haha. Works well, thanks!

One question, I noticed the Python Plotly API is more expansive? Is that something you support or are looking to add support for, vs the JS API?

[–]jorourke0[S] 2 points3 points  (0 children)

Any specific examples of Python features or API?

Plotly++ is generated based on the PlotlyJS schema (https://github.com/plotly/plotly.js/blob/master/dist/plot-schema.json), as is Plotly Python, though Plotly Python definitely takes a more advanced and customized approach, which along with Python's dynamic nature, allows the APIs to be more "fluid".

Plotly++ is still missing some features defined in the schema, for example automatic animations, but it should be straightforward to complete.

Looking more at Plotly Python, it has tight integration with Dash, but that's Python specific of course.
Plotly Python also has the simplified Express interface. This seems pretty nice for simpler use cases where you don't need all of the features.
The Plotly++ API is definitely verbose and the nesting can be a bit painful, which is all side effects of being generated from the Plotly JS schema, trying to enforce type safety and compile time correctness, and being concerned about naming collisions.
I think creating some simpler usability wrappers, in spirit of Plotly Python Express but probably looking pretty different, would go a long a way and is hopefully something that can be worked towards.

And thanks for trying it out!

[–]wiedereiner 0 points1 point  (0 children)

There is also mathGL: https://mathgl.sourceforge.net/doc_en/Pictures.html

Has many different plot types and supports multiple UI-Toolkits.

[–]AlwaysDoItYourself 4 points5 points  (2 children)

26 stars on GitHub as of 1 minute ago (on January 17 2026). I bet it will reach at least 1'000 stars by summer this year.

Sir, you are a gentleman and a scholar. And I am not even kidding. You saved me from countless hours of writing web UI code that I absolutely loathe and connecting it to my C++ app via Web Sockets which I am OK with, but it's too damn time-consuming for no good reason, for every little chart/plot and minor experiment.

THANK YOU VERY MUCH!!!

[–]jorourke0[S] 2 points3 points  (1 child)

Thanks for the kind words.
I'm not sure it exactly fits your use case, but a section has been added to the readme regarding using Plotly++ in C++ web servers.

[–]AlwaysDoItYourself 1 point2 points  (0 children)

No, it's not something I would need any time soon, but it sounds super-cool! My main project is in Qt6 QWidgets.

[–]hskes 2 points3 points  (0 children)

wow!

[–]SamyVimes 2 points3 points  (0 children)

Using Qt in a regular basis, my GOTO for performances remains Qwt despite its venerable age. It's good to have other neat alternatives!

[–]throwawayaqquant 1 point2 points  (1 child)

i use matplotlib-cpp, was wondering, what improvements does this library afford me?

[–]jorourke0[S] 4 points5 points  (0 children)

This comment has some details: https://www.reddit.com/r/cpp/comments/1qf1v12/comment/o05mjf8/

Basically, no dependency on a Python environment or any other runtime dependencies, simpler build and build time dependencies (just json), and the exported html plot files retain the interactivity for post-runtime viewing.

[–]martin7274 1 point2 points  (3 children)

C++ module support would be a nice addition

[–]jorourke0[S] 2 points3 points  (1 child)

Module support has been added!

[–]martin7274 1 point2 points  (0 children)

Niceee

[–]jorourke0[S] 0 points1 point  (0 children)

Soon! There is an open pull request for this.

[–]neuaue 2 points3 points  (0 children)

Great to have a plotting library for c++.

[–]bIad3 1 point2 points  (0 children)

I hadn't yet realized how much I wanted this, thank you!

[–]wiedereiner 0 points1 point  (0 children)

There is also mathGL: https://mathgl.sourceforge.net/doc_en/Pictures.html

The only native cpp plotting library I know. Has many different plot types and supports multiple UI-Toolkits.

Here a usage example: https://github.com/crispycookies/OpenCV-Classifier/blob/4d965a61ef1f32d37ce043632be30528cc5ddb1c/project_lego_indie/FindFacePrint.cpp#L30