Subscribe to this blog

There is no easy way for blind people to have a quick look at a mathematical function or at a data plot of measurements. All available solutions rely on sighted assistance.

Recently, I had to plot some measurement data that I had taken from an oscilloscope. It was dissatisfactory to not be able to see what kind of curve I had plotted, so I wondered whether I could get an ASCII representation of the plot. In the old days, where the text console was the norm and not the exception, people needed a solution to have a look at their plots without printing it to paper, first. So they developed a "dumb" terminal driver for Gnuplot, which approximates the plot in ASCII art. This is extremely handy, because a braille display for the blind is made exactly for this purpose: to display text.

The following example illustrates how to plot $x^2$ optimized for a 40 cell braille display. Open Gnuplot and enter the commands (as shown below behind the gnuplot> prompt):

gnuplot> set terminal dumb 42 20
Terminal type set to 'dumb'
Options are 'feed  size 42, 20'
gnuplot> f(x) = x*x
gnuplot> plot f(x)

   100 *+------+-------+------+------+*
       **      +       +  f(x)+********
    90 +*                            *+
    80 ++*                          *++
       | **                        ** |
    70 ++ *                        * ++
    60 ++ **                      ** ++
       |   *                      *   |
    50 ++   *                    *   ++
    40 ++   **                  **   ++
       |     **                **     |
    30 ++     **              **     ++
    20 ++      **            **      ++
       |        **          **        |
    10 ++      +  ***  + ***  +      ++
     0 ++------+----******----+------++
      -10     -5       0      5       10

To ease the understanding of the characters for a braille display user, I'm going to explain a few of the used signs here. The "-" sign marks a horizontal line, the "|" sign a vertical line. The "+" signs are just to show where the numbers are. The most interesting sign is the "*", since the function is plotted with it.

The commands above do the following:

  • set terminal dumb 42 20: Set the output to ASCII with 42 characters on each line and 20 lines in total.\

    Details on width and hight of the resulting graphic can be found further below.

  • f(x) = x*x defines the function. You can define variables before and use them in the expression. There are already functions predefined (e. g. sin and log) so you can use them in your function definitions.

  • plot f(x): plots the defined function.


A second example with measurement data could look like this:

gnuplot> set terminal dumb 42 20
Terminal type set to 'dumb'
Options are 'feed  size 42, 20'
gnuplot> plot 'data.dat' with points

   90 ++---+-----+----+----+-----+---++
      +    +     +  'data.dat'   A    +
   80 ++                             +A
      |                               |
   70 ++                             ++
      |                               |
   60 ++                   A         ++
      |                               |
      |                               |
   50 ++                             ++
      |          A                    |
   40 ++                             ++
      |                               |
   30 ++                             ++
      +    +     +    +    +     +    +
   20 A+---+-----+----+----+-----+---++
      1   1.5    2   2.5   3    3.5   4

data.dat contains measurement data, as you might have guessed. The data points are represented using the character A. Gnuplot is clever enough to distinguish between different data sources, a second data file within the same plot would have different point markers (for this example B).

About width, height and the margin

Different braille displays have different length and therefore it makes sense to adjust the size of the plot to your needs. The dumb terminal of Gnuplot accepts two options: width and height. For a 80 cell display, you could therefore type:

gnuplot> set terminal 80 30

The number of lines always depends on how much you want to navigate up and down, but also on how big your graph is. In general, I like to use 20 lines with a 40 character display.

Gnuplot likes to make plots look nice. For an ASCII plot, this is useless and for blind users, this is simply a waste of space. Therefore the margin (left/right) can be omitted or decreased:

gnuplot> set rmargin 0

The left margin can be left unchanged or calculated manually. There is always one space from the y-Axis label and it is followed by the number. For a two-digit number you would use:

gnuplot> set lmargin 3

(or even 4 if you have also negative numbers). But again, I suggest leaving the left margin unchanged.

You can save those instructions into a file and load it every time you open Gnuplot, so that you save some typing. Open e. g. braille.plt and put something like this into it:

set terminal dumb 40 20
set rmargin 0

and load this file using

gnuplot> load braille.plt

You can there predefine some functions too, if you like.