6

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.

1
  • You may want to try Qwt. Commented Apr 2, 2014 at 13:21

2 Answers 2

6

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

Sign up to request clarification or add additional context in comments.

2 Comments

How does this work out for cross system solutions. I just make different methods for each system and call the right system call? Does the iostream lib work for cross system. Thanks.
All you would need to do is change the name/path of the gnuplot executable in the system call
0

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.

1 Comment

Thanks. Had a hard time to find some examples of KD Chart, but I think that gnuplot offers a bit more scientific kind of plots, atleast for my taste in my reports. Thank you for the reply.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.