I want to plot some graphs with (x,y) points which is generated from a C++ programme. I can successfully plot these data from gnuplot command from a terminal.
But I want to plot the same thing from a C++ programme, is this thing possible in ubuntu 16.04 lts ?
Sure, just install gnuplot using standard package command:
sudo apt-get update
sudo apt-get install gnuplot
After that you just need to integrate gnuplot iostream header which is an interface for gnuplot from C++:
#include "gnuplot-iostream.h"
This header is not included when you install gnuplot but can be found here. Here you have an example link of iostream for reference: iostream example code C++
I am adding an answer since I cannot comment. As hackela said you can install gnuplot, then you can install gnuplot-iostream from aptitude instead of dowloading manually the header file, with this command:
sudo apt-get install libgnuplot-iostream-dev
Another option: C++ lib matplotplusplus is actually sending drawing commands to GnuPlot. It provides an API similar to python matplotlib. It is available in C++ package manager vcpkg.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With