Chapters:
1: Introduction
2: Simple example
3: Invocation
4: Finer Control
5: X-Y Plots
6: Contour Plots
7: Image Plots
8: Examples
9: Gri Commands
10: Programming
11: Environment
12: Emacs Mode
13: History
14: Installation
15: Gri Bugs
16: Test Suite
17: Gri in Press
18: Acknowledgments
19: License
Indices:
Concepts
Commands
Variables

# 1: Introduction

Gri is a programming language for drawing science-style graphs. It is not mouse-driven, and it does not draw business-style graphs (e.g. pie charts, three-dimensional graphs). Gri has substantial power in advanced applications. It has been proven to be easy to learn; for simple applications, the learning curve is less than an hour. Many users regard Gri as the plotting equivalent of the LaTeX document preparation system.

Computers Gri works on: unix computers of many types, plus Microsoft Windows, and Macintosh OSX. You'll find Gri pre-packaged for various unixes, e.g. linux/debian, linux/redhat, and freeBSD.

Capabilities of Gri are those scientists commonly want, since Gri was written by a scientist. It is not so useful for business people -- e.g., Gri draws xy graphs (see X-y Plots), contour plots (see Contour Plots), and image plots (see Images), but it will not draw pie-charts unless you teach it how. The list of capabilities of Gri is similar to many packages, but unlike many of the other packages, Gri gives you control over line widths, fonts, grayscales, etc. (see Getting More Control), and it is a programming language of moderate power.

The Gri drawing metaphor is that of pen on paper. The ink in the pen is opaque. An item drawn in white ink will erase a previously drawn underlying object drawn in black ink. For example, to draw a timeseries curve in which the region between positive data values and the y=0 axis is filled with black ink, you might use (``draw curve filled`') to draw the timeseries with black ink (the default color), blackening the area between the curve and the lower axis. Then you could load white ink into the pen (using the ``set graylevel 1`' or ``set graylevel white`' command) and white-out a box drawn between the zero line and the lower axis. Then you'd load black ink back into the pen (``set graylevel 0`') and draw the curve again, so that the negative part would appear again.

Input/output in Gri may be interactive or non-interactive. For interactive use, type ``gri`' at the system commandline prompt. For non-interactive use, with Gri commands in a command-file called ``cmd.gri`', type ``gri cmd.gri`'.

Gri output is in the PostScript page description language. The output is therefore of high quality, device-independent, capable of being inserted into popular text processors (e.g. LaTeX), and easily displayed.

Online help: the Gri command ``help`' makes Gri list the first words of all known commands, along with a hint for getting further help. To get more information, type ``help`' followed by a command-name (e.g. ``help read`'). There is also a tiny bit of information stored online and categorized by topic. Get this by typing for example ``help - strings`' (see Online Help).

Data analysis in Gri is limited. It has rudimentary data analysis functions, such as regression, column manipulation, smoothing, etc, but it is not intended as an integrated analysis/graphics package.

System calls are an easy and important facet of Gri. It is easy to use operating system commands within Gri (see System; see Operating System; see Get Env). This allows you to use familiar, powerful tools, and keeps Gri simple. Particularly useful is the ability to read files through operating system filters (see Open).

Programming Gri is quite straightforward, and users familiar with other programming languages find it easy. If Gri lacks a drawing method, you can add it fairly easily, since Gri has programming elements such as ``if`' statements (see If Statements), ``while`' loops (see While), facilities for interacting with the user (see Query), and mechanisms for storing numbers in "variables" (see Variables), and text strings in "synonyms" (see Synonyms). The Gri syntax can be augmented easily (see Adding New Commands), and these augmentations can be stored in a startup file (see Resource File), creating personalized versions of Gri.

Manuals: Gri has an online texinfo manual, a PostScript manual, a WWW manual, a cookbook and several reference cards. It also has several discussion groups (see Discussion Group).

Version Numbering Scheme

When you launch Gri interactively (without naming a commandfile, i.e. by just typing ``gri`' at the unix prompt), you'll see something like

     gri - scientific graphic program (version 2.12.27)
     GPL Copyright 2015 by Dan E. Kelley.

     Type `help' for an overview of Gri commands, or see the
     full manual at
         /usr/share/doc/gri-2.12.27/html/index.html
     and its text-only version in the 'gri' INFO node.

     Visit http://gri.sourceforge.net for updates and resources.
    gri:

The last line is a prompt, suggesting that you type in Gri commands. You may type ``quit`' to get out of gri.

The first line gives the version number. You can also get this by running Gri with the command ``gri -v`'. Version numbers have three numbers separated by periods. The first number increments for major changes, the second for smaller changes, the third for still smaller changes. The second number also indicates whether a copy is an experimental version or a more reliable release version. Experimental versions have the second digit being an odd integer, while release versions have this digit being even.