This recipe covers a quick and easy way to visualize a list of 2D points as scattered dots within an image.
The library used in this recipe uses gnuplot to render the graph. We should first install gnuplot.
On Debian-based systems such as Ubuntu, we can install it using apt-get
as follows:
$ sudo apt-get install gnuplot-x11
The official place to download gnuplot is from its main website, http://www.gnuplot.info.
After gnuplot is set up, install the easyplot
Haskell library using cabal as follows:
$ cabal install easyplot
Also, install a helper CSV package as follows:
$ cabal install csv
Also, create two comma-separated files, input1.csv
and input2.csv
, which represent two separate sets of points as follows:
$ cat input1.csv 1,2 3,2 2,3 2,2 3,1 2,2 2,1
$ cat input2.csv 7,4 8,4 6,4 7,5 7,3 6,4 7,6