Each data point is on a separate line. The first and second columns were the X and Y coordinates of the data. The third column represents that which of the 4 classes (0-3) that points belonged to.
To understand the data better, I wanted to visualize it by drawing a 2D plot with a point for each data point. To distinguish the points belonging to different classes, I wanted points of each class to be drawn with a distinct color.
Once your data is in this format, achieving the above is easy in Gnuplot:
Gnuplot can plot in ASCII at the terminal if the dumb terminal is chosen. However, this does not fully utilize the Unicode characters and color support of modern terminals. The Caca terminal of Gnuplot uses all the character and color capabilities of your terminal to generate beautiful and colorful plots. It does this by using the Caca library which provides these capabilities.
Build or Install
Gnuplot can be installed easily:
$ sudo apt install gnuplot
Note that support for caca terminal was added in Gnuplot 4.7. If you have that version and it was built with support for caca, then the commands in the next section should work directly.
If you do not have 4.7 and later and if it was not built with caca support, you need to build Gnuplot from source. Here are the steps I followed to build it from source:
Download Gnuplot source code from here and unzip it to a directory.
Install the Caca library if you do not have it already:
$ sudo apt install libcaca-dev
While building Gnuplot, I got an error in source files that use WxWidgets. To fix that, I opened the configure file, looked for the WX_CXXFLAGS option and appended -std=c++11 to its string.
While building Gnuplot, I got an error about linking with a X11 library. To fix that, I opened the configure file, looked for the WX_LIBS option and appended -lX11 to its string.
We are now ready to configure and build. Remember to configure with support for caca, since it is still an experimental feature and not enabled by default:
$ ./configure --with-caca
If the build is successful, you can install Gnuplot:
$ sudo make install
To use the caca terminal in Gnuplot:
gnuplot> set terminal caca
You can now plot anything and Caca draws it using ASCII/Unicode characters and colors.
You will notice that Caca opens a X window to draw the plot. If you would like it draw the plot in the terminal itself, then you need request caca to use a driver that can draw at the terminal.
You can view the list of drivers supported by caca:
gnuplot> set terminal caca driver list
Of these, the ncurses and slang drivers can draw to terminal. I found that using slang draws in color, but it shows lots of question mark symbols. So, I use ncurses:
gnuplot> set terminal caca driver ncurses
Now plot anything and view it in beautiful ASCII/Unicode and colors at the terminal!
You can find an extensive list of plots drawn using Caca here.
Tried with: Gnuplot 5.0.0, Caca 0.99.beta18 and Ubuntu 14.04
Gnuplot can be used to plot or write to file existing 3D triangulations. Though its output is not fancy or beautiful, it can be a quick tool to check results. Here is how to render:
A 3D triangulation or 3D surface mesh consists of tetrahedrons or triangles. Write the triangulation as a list of line segments to a text file. If the triangulation consists of tetrahedrons, then these could be the edges of the tetrahedrons. The line segments file should be written in the following format:
3 4 9
6 9 1
10 45 78
23 67 90
Note that the 3D coordinates of each of the two vertices of a line segment should lie on separate lines. Also, each pair of point coordinates is separated from the next by 2 newlines. This is the format required by Gnuplot.
Open Gnuplot, plot the segments file using points, lines or linespoints using a surface plot:
Gnuplot is an awesome graph plotting program that has been around since the time of dot-matrix printers and teletype terminals. Little wonder that it has support for such archaic output devices even today. One such output terminal supported by Gnuplot is called the dumb terminal.
I find the dumb terminal pretty useful to have around in the initial stages of plotting to get a rough idea of the data. The default terminal on Windows is called wxt and gnuplot pops up a new window to display the plot. If you find that and switching between windows distracting, use the dumb terminal which plots a quaint ASCII-art graph! 🙂