Remote plotting via XTerm
=========================

One of the  main features of UNIX systems is  ability to work remotely.
Many of  us have shell accounts  at the SDF  or elsewhere so it  is not
necessary to explain the features of remote access.

I  think  that  the  most  of  people  uses  their  remote  shells  for
console-oriented stuff like IRC, mail, git, text editors, off-line data
processing and so. But  if one works with some data  it is often useful
to be able to  visualize them. The obvious way is to  use X11 [1]. This
is of  course possible but  remote X11  connection is usually  slow and
lagging when  it is  used via  big networks. Then  using of  modern GUI
programs (based on the Gtk, for example) is usually a pain.

But  in many  cases a  simple  2D graph  is  enough. And  there is  one
somewhat  forgotten  way how  to  visualize  these things  from  remote
machines:  the old  good XTerm  [2] can  actually show  simple graphics
elements. It  can do because  it can only work  as a VT100  (or better)
emulator but it also can emulate the Tektronix 4014 graphical terminal.
The emulation might be limited but it is still enough to show black and
white lines and texts.

The XTerm has to be started with the "-t" parameter:

-------------------------------------
xterm -t
-------------------------------------


But how to generate such graphics? Some software offer direct output in
Tektronix format. The old UNIX command  plot(1) [2] can do the same and
the graph(1)  can prepare the  graph data  from text files.  The modern
"plot" and  "graph" implementations can  be found in the  GNU Plotutils
package [4].

To plot a simple  graph on a Tektronix terminal one  needs to prepare a
text file  (say, "file.txt") with data  (two colums, first is  X value,
second is Y) and then to plot it:

-------------------------------------
cat file.txt |graph |plot -Ttek
-------------------------------------

And if one wants something more  sophisticated then there is always the
Gnuplot [5].  It can use  the "tek40xx" or  the "vttek" terminals  or a
terminal called  "xterm". I  recommend the later  because it  opens two
windows:  the first  is the  usual  XTerm (vt100  compatible) with  the
Gnuplot command  line and the  second is a  Tektronix-compatible window
for graphics.  So one  can work  normally with  the exception  that the
graphics is only black and white.

And of course the GNU Octave often uses the Gnuplot for graphics so one
can benefit from this solution also when working with the Octave.


References:

[1] https://sdf.org/?tutorials/x11_forwarding
[2] http://invisible-island.net/xterm
[3] https://linux.die.net/man/1/plot
[4] https://www.gnu.org/software/plotutils/
[5] https://gnuplot.info