📅 2015-May-11 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ caca, dumb, gnuplot, ncurses, slang, terminal, x11 ⬩ 📚 Archive
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.
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
$ make
$ sudo make install
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
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!
Tried with: Gnuplot 5.0.0, Caca 0.99.beta18 and Ubuntu 14.04