We're going to use gnuplot to render dumb text graphics and canvas-style plots inside our Terminal. To begin, we need some basic configuration for our gnuplot startup. Put the following in ~/.gnuplot:
set term dumb
Next, we need a wrapper around gnuplot to get some fancy graphical output. This wrapper looks at the GNUTERM environment variable of your current shell and does some calculations on the Terminal's width and height so that gnuplot knows how big a window it has. The wrapper will update our ~/.gnuplot configuration with the graphics capabilities specified for our Terminal. We aren't going to delve into the wrapper, but just use it as another command. Here it is:
__gnuplot() {
SIZE=$(stty size 2>/dev/null)
SIZE=${SIZE:-$(tput lines) $(tput cols)}
COLS=${SIZE#* }
ROWS=${SIZE% *}
XPX=${XPX:-13}
YPX=${YPX:-24}
COLUMNS=...