简体   繁体   中英

How Can I Change The Line Color And Line Width of Gnuplot plots directly from My C++ Program?

I am currently trying to plot vectors directly from my C++ program (without saving anything to file) using gnuplot. I had no problem getting started using the c++ gnuplot interface available at https://code.google.com/archive/p/gnuplot-cpp/ but can't seem to find any documentation available changing the line color and line width.

Am I missing something? I can't seem to find much documentation on using gnuplot directly from c++ in general. Can anyone refer me to a good reference on this? The limited examples provided with the c++/gnuplot interface cover very little of gnuplots features and I'd really love to be able to leverage them all directly in my c++ programs. Help much appreciated and thanks in advance!

As you can see, that library is not maintained and no documentation is available. You can still download the 50 KB large source code and understand the basic logic behind it. You can bypass most of the wrapper by using Gnuplot& Gnuplot::cmd(const std::string &cmdstr) , in which case you can pass gnuplot codes such as plot sin(x) lw 3, cos(x) lw 1 . If you update gnuplot, this wrapper may get broken.

I'd recommend finding another library for Gnuplot on github. One of the most forked is dstahlke's gnuplot-iostream . I don't know if it is just a name collision, but there is gnuplot-cpp too, from another author.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM