Poul K. Sørensen
Poul K. Sørensen

Reputation: 17540

c++ application using qt, how to include gnuplot

Im looking for a solution or some guidelines on how to, from a c++ application using Qt, create scientific plots. I have set my mind on gnuplot because it have nice features for later use of my plots in latex and such.

My question is then, can i and how do i accomplish to show a plot in qt and also makes it possible to expose the gnuplot commands for generating the plot later for reporting.

Should i based on my data create some datafile, and create a text file with the commands?

Can it be integrated into my c++ application such that i create the plot, see it in my application and then save the data and plot file.

Any input would be nice. I dont now gnuplot at the moment, and wonder if its a application on unix or its a library i can use in my application. Thanks.

Upvotes: 6

Views: 9371

Answers (2)

Seamus Boyle
Seamus Boyle

Reputation: 109

If your not set on gnuplot look into:

  • KD Chart, it uses Qt ModelView programming model. It's cross platform and even has a plugin that appears as a widget in Qt Designer.
  • The R-Project is great for plotting might be all you need as a standalone program, but also as a Qt interface R-Forge. It too is cross platform.

Note: I havn't tried R-Forge yet. R is actually a statistical programming language. KD Chart targets business type charts but may have what you need.

Upvotes: 0

Martin Beckett
Martin Beckett

Reputation: 96119

Easiest way is to have your app run gnuplot in a system() or similar call, plotting to an image and then display the image.

If you want more detailed control there is an iostream lib to talk to gnuplot or an old C interface

Upvotes: 6

Related Questions