Scatter Plots in C++

paxos1977 picture paxos1977 · Oct 18, 2008 · Viewed 76k times · Source

What is the best way to graph scatter plots in C++?

Do you write data to a file and use another tool? Is there a library like matplotlib in Python?

Answer

freespace picture freespace · Oct 18, 2008

I always write out data and then using gnuplot to create my graphs. It is by far the best way I have found of producing graphs in a variety of formats: eps, png, jpeg, xpm, you name it.

gnuplot will do scatter plot very easily. Provided the x and y values are in 2 space-separated columnss, then

plot "data.txt" using 1:2 

Will give you a quick scatter plot. Then you can adjust it and what not using other gnuplot commands.

If you are involved in sciences, then learning gnuplot will be very valuable to you. It kicks the crap out of doing excel plots for sure and it eases the task of making plots to include in papers.