Scatter Plots in C++

If you are looking for a C++ library rather than I independent plotting tool like gnuplot, I would consider the following:

  • Koolplot
  • dislin (Wikipedia article on dislin)

dislin seems to be the more interesting of the two. Here is a description extracted from the wikipedia article:

DISLIN is a high-level and easy to use plotting library developed by Helmut Michels at the Max Planck Institute in Katlenburg-Lindau, Germany. Helmut Michels currently works as a mathematician and Unix system manager at the computer center of the institute.

The DISLIN library contains routines and functions for displaying data as curves, bar graphs, pie charts, 3D-colour plots, surfaces, contours and maps. Several output formats are supported such as X11, VGA, PostScript, PDF, CGM, HPGL, SVG, PNG, BMP, PPM, GIF and TIFF.

DISLIN is available for the programming languages Fortran 77, Fortran 90/95 and C. Plotting extensions for the languages Perl, Python and Java are also supported for most operating systems. The current version of DISLIN is 9.4, released in October 2008. The first version 1.0 was released in December 1986.

The DISLIN software is free for non-commercial use.


Very heavy solution: you could link against ROOT, which will do just about anything you want:

  • runs on Mac, Windows and Linux
  • runs compiled or using the cint interperter
  • output to a file in encapsulated postscript, PDF, gif, png...
  • display to the screen using several different technologies
  • serialize the data in an internal format that can be manipulated later

Sure, its a bit much for most people, but it does do exactly what you asked for. I use it because I know it and it is already on my machines becase I'm that kind of physicist.


Good old GNU, they have everything...

http://directory.fsf.org/project/plotutils/


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.