GPLOT recipes: Using GPLOT for the first time


GPLOT is written for those who want a lot of flexibility in creating plots and are not satisfied with standard plotting facilities in other GIPSY applications.

GPLOT is a General Plot program based on subroutines of the plot package PGPLOT and specially written routines to interface with the GDS (GIPSY Database System). The program enables you to plot contour- grayscale- and colour plots of GIPSY images. It plots profiles taken from a GIPSY image, reads data from file, manipulates this data (using expressions) and plots it in various ways (line diagram, histogram etc.). GPLOT labels axes with physical coordinates if those axes are related to a GIPSY set. GPLOT is command driven and therefore cannot be compared with a program like CPLOT which is controlled by keywords.
GPLOT has one major keyword:

COMMAND= 
This keyword is prompted in a loop. It processes plot commands like frame, move, draw, quit etc. with or without parameters. For the (very) impatient we introduce the command that closes files and quits GPLOT:
COMMAND=quit
Like all GPLOT commands, this command can be written in upper- or lower case and it can be abbreviated. So the following commands all have the same effect:
COMMAND=quit
COMMAND=q
COMMAND=Quit
COMMAND=Q
Command quit is one of the commands that has no parameters. Commands like move and draw must be followed by parameters. Others, like lstyle and location generate information if used without parameters or execute code if used with parameters.
GPLOT has only one important GIPSY keyword: COMMAND= Entries for this keyword are called (GPLOT)commands. Commands can have parameters.
Hereafter we will not refer to keyword COMMAND= anymore, but discuss only the GPLOT commands. Before a plot can be made, an output destination must be selected. A destination is set with command device. Without a parameter, it will list the currently available devices. Here are some choices that you can make: If you give a plot command before you select a device, GPLOT will prompt you with keyword GRDEVICE=
First GPLOT command should be device with a parameter to specify the destination of the plot output.
At this stage, you are ready to give any plot command that is recognized by GPLOT. A list of commands can be generated with:
help
An Ascii file (myhelp.txt) with a short description of all available commands can be made with:
file myhelp.txt help
Specific help can also be obtained with the help command. Suppose you want some information about all commands containing the word 'lab':
help *lab*
From within Hermes, it is always possible to consult the GPLOT documentation (this is not the so called gplot.dc1 document!) with command manual. You enter an editor (defined by environment variable EDITOR) that displays an Ascii version of the GPLOT documentation.
Command help without parameters displays a list of all available GPLOT commands.
As an example of a simple plot, lets try to create a gray scale plot with some contours and default axis labeling. Start GIPSY and type GPLOT. You are prompted with keyword COMMAND= until you enter quit. Type the following commands at this COMMAND= prompt and press enter after each command.
device ppsfile/aurora.ps
inset Aurora freq 7
box -156 -56 -35 64
xsize 65
ysize 65
levels 0.5 0.9:13.5:1.8
grayscale
levels 0.9:18:1.8
contours
frame
close
Output will be sent to file aurora.ps on disk. The GIPSY set is called Aurora and we want data from the 7th subset in frequency. Scaling of a plot is always done in combination of two commands. The first sets the limits (box or xrange & yrange). The second sets the number of grids/mm (xsize & ysize or range & yrange). box without parameters will read the entire subset. Commands xsize and ysize are the width and the height of a plot in millimeter. If you want a scale that fills the plot device, use command autoscale after inset or box. Gray scale and contour commands read the contents of what is set with levels. The syntax for entering these levels is the same as the standard GIPSY syntax for numbers, so 0.9:18:1.8 evaluates to levels 0.9 2.7 4.5 ... 17.1. Command frame draws the axes and plots the coordinate labels. A device is closed after command close.
Plots sent to devices other than the screen are ready only after command close or quit.
What to do if you want to draw the plot again but with different contour levels? If you didn't use quit there is no need to retype all the commands again. There are several ways to change commands that you already entered and play back the sequence. But the most flexible way to handle this is using the commands write and input. It is possible to write all previously entered commands to a file with:
write main mycoms.txt
main is the name of the macro you are building if you just started GPLOT and entered commands. In this macro, all commands are executed immediately. Edit file mycoms.txt in an editor outside Hermes. Execute the commands from mycoms.txt with:
input mycoms.txt
But before you do this, it is convenient to clear a screen device with erase or clear.
The file that you saved is called a command file. Command files can have comments. A comment starts with the '!' character. In this document such command files are used as recipes for example plots.
Commands can be read from an Ascii file and executed immediately with the input command.
GIPSY