Next: 5 Images
Up: Part I: General Concepts
Previous: 3 General Graphics Concepts
This chapter introduces the commands used to generate one and two
dimensional plots.
This first section deals mainly with commands that do not require data;
the second section with plotting commands that require data.
Data may be loaded using the commands of section 3.7.
Chapter 3 introduced commands that define the
current graphics device,
border drawing commands like
box
(Section 3.5),
commands needed to control
some of the graphical attributes (Section 3.4),
and commands that can adjust the values of the coordinate systems
(Section 3.3).
Many of the concepts described in Chapter 3
will be useful here.
This section describes some of the WIP commands that may be called
that do not generally act on input data.
Examples of many of these commands
are shown in Appendix E.
An explanation of the optional and required arguments as well as
a more detailed description of each of the following commands
is available both
in Appendix D and via the on-line help using the
help command.
- arc --
-
Draws an arc relative to the current cursor position.
The command requires the major and minor
axes as inputs and may be drawn over a specified angular extent,
start at a particular angle, and be rotated by a specified amount.
The attribute ``fill'' determines whether
the arc will be filled or outlined.
All angles are in units of degrees, start from the right side of
the viewport, and increase counter-clockwise.
NOTE: This command is very dependent on the aspect
ratio of the plot region;
especially if the arc is rotated.
- arrow --
-
Draws an arrow from the current cursor position to the specified location.
The arrow shape (acute angle of the arrow point and the fraction of
the triangular arrow-head that is cut away from the back)
may be controlled by use of optional arguments to the command.
The attribute ``fill'' determines whether
the arrow will be filled or outlined.
- autolevs --
-
Automatically computes (fills) the contour level array elements
for use with contour plots (see Chapter 5).
- beam --
-
Draws a beam at the current cursor position.
- dot --
- Draws the current symbol
type at a requested position or the current cursor position.
- draw --
- Draws from the
current cursor position to the specified position.
- erase --
- Erases the graphics
screen. If the ``ask'' attribute is set,
then the user
will be prompted before the screen will be allowed to be erased.
- globe --
-
Draws a projection globe to use with positions generated
with the aitoff command.
- hardcopy --
-
Spool the current plot to the printer
(applicable only when the current device is a hardcopy type).
- hls --
- Sets
the color of the specified color index to the input
Hue-Lightness-Saturation level.
- input --
-
Read and execute the WIP commands from the named file.
- ldev --
-
List the devices that are currently available to WIP.
This is equivalent to the command
device ? .
- levels --
-
Specify the levels for a contour plot (see Chapter 5).
- lines --
-
Specify which range of lines of a data file to read
(see Section 3.7).
- lookup --
-
Specify a lookup table for gray scale plots
(see Chapter 5).
- macro --
-
Read and define, but do not execute, the WIP macro definitions
from the named file.
- move --
-
Move the current cursor position to the specified position.
- minmax --
-
List the minimum and maximum of the current image.
- palette --
-
Select a lookup table for color halftone plots
(see Chapter 5).
- phard --
-
Replay the current plot commands to a specified device and then return to
the current device.
This is useful for spooling a plot to a hardcopy device.
- playback --
-
Repeat (execute) the commands in the command buffer
or any named macro.
- plotfit --
-
Plots the most recent results from the
fit command.
- read --
-
Read, but do not execute, the WIP commands in the named file.
- rect --
- Draw a rectangle bordered
by the specified vertices. Many of the attributes listed in
Section 3.4 affect the resulting rectangle.
- reset --
- Resets the current
graphics state (i.e. attributes)
to the way it is when the device is first selected.
- rgb --
- Sets
the color of the specified color index to the input Red-Green-Blue values.
- set --
-
Discussed more fully in Section 8.3.
- show --
- Discussed in
Section 3.2.
- slev --
-
Permits scaling of the contour level array
(see Chapter 5).
- string --
-
Discussed more fully in Section 8.3.
- submargin --
-
Specifies the gap distance between individual frames.
For use with the panel command.
- wedge --
-
Draws a halftone wedge to illustrate the
range of halftone values (see Chapter 5).
- write --
-
Writes the command buffer or named
macro(s) to the named file.
The following is a simple example of the use of some of these commands,
including how to save a list of plot commands out to a file for later use
(see Section 7.6
for a more detailed explanation of saving and recalling commands).
- WIP>
- limits 0 10 0 100 # Set the World limits (§ 3.3).
- WIP>
- color 3 # Set the color to green (§ 3.4).
- WIP>
- rect 3 5 80 90 # Draw a filled green rectangle.
- WIP>
- move 5 80 # Move the pen position.
- WIP>
- color 2 # Set the color to red.
- WIP>
- draw 2 40 # Draw a red line.
- WIP>
- symbol 2 # Set current symbol to ``+''.
- WIP>
- move 4 40 # Move the pen position.
- WIP>
- dot # Draw a ``+'' at the pen position.
- WIP>
- erase # Erase the graphics display.
- WIP>
- playback # Redraw everything up to the erase command.
- WIP>
- write myfile.wip # Writes commands to the file ``myfile.wip''.
- WIP>
- delete 1 100 # Clear the command buffer
(see § 7.4).
- WIP>
- erase # Erase the graphics display.
- WIP>
- input myfile.wip # Execute the commands in ``myfile.wip''.
- WIP>
- phard /ps # Spool this plot to a PostScript printer.
- WIP>
- end # Exit WIP.
Plots generally referred to as scatter or xy plots are
usually the result of single variable expressions.
Displaying these plots can be done in point mode
(e.g. points ) or in line mode
(e.g. connect ).
WIP has a variety of commands available to vary how these plots are
generated and displayed.
Useful in distinguishing various data sets (and how the subsequent
plot will look) are the various
attributes described in Section 3.4
and the various techniques used to border the plot (see
Section 3.5).
The following is a list of the current single variable plot
commands and a brief description
of what they generate.
For a more detailed description and a list of any required or optional
arguments, use
help cmd (where cmd is one of
the following commands) or look at the listing in Appendix D.
- aitoff --
- converts longitude
and latitude positions into the equivalent x and y positions
for use in an Aitoff (more correctly, Hammer) projection.
- bar --
- draws a bar graph
at each of the positions read into the current X and
Y arrays.
The bar may extend in either the or direction.
The color of each bar is determined by the corresponding values
in the current ERR array.
The current color index is used if the ERR array is empty.
- bin --
- draws a stepped
line plot (histogram).
A user supplied parameter may specify how to handle irregularly spaced
arrays and arrays with direction reversals.
- connect --
- draws line
segments to each of the positions read into the current X and
Y arrays.
- errorbar --
- draws error
bars on each of the positions read into the current X and
Y arrays with the magnitude of the error bar set by the values
in the ERR array.
The error bar may extend in either the or direction.
- histogram --
- generates
a histogram from the data in the current X array.
- lcur --
- interactive routine
to generate a polyline.
Vertices are selected using the cursor and are stored in
the current X and Y arrays.
- logarithm --
- changes the
named array to it's base-10 logarithm (with an optional scaling).
- ncurse --
- interactive routine
to generate a set of data points.
Points are selected using the cursor and are
stored in the current X and Y arrays (in increasing x order).
- olin --
- interactive routine
to generate a set of data points.
Points are selected using the cursor and are
stored in the current X and Y arrays
(in the order they were added).
- points --
- draws points of
the current point style at the positions of the current X and
Y arrays.
Point styles for each point may be stored in the current PSTYLE array.
Colors for each point are retrieved from the current ERR array.
- poly --
- fills a polygonal area
defined by the current X and Y arrays.
- vector --
- draws arrows using
the current point positions from the current X and Y arrays
and extending a radius (specified by the values
stored in the current PSTYLE array) at an angle (degrees
positive counter-clockwise from the +x-direction
and specified in the current ERR array).
Each arrow's shape (acute angle of the arrow point and
the fraction of the triangular arrow-head that is cut away from the back)
may be controlled by use of optional arguments to the command.
The attribute ``fill'' determines whether
the arrow will be filled or outlined.
Most of the above commands operate on the current X and Y
arrays (see section 3.7).
There are also two pre-defined arrays called PSTYLE and ERR which
are used along with the X and Y arrays to affect the look of
the plot.
For example, the command errorbar
uses the ERR array to determine the length of the error bar drawn
at each point.
As another example, the command points
uses the integer part of the PSTYLE array value
to set the symbol number for each point.
The symbol
number
corresponds to the type of symbol drawn.
If the symbol number is less than -2,
it draws a filled polygon
of N sides where N is the absolute value of the symbol number.
If the symbol number is -1 or -2, it draws a dot
of the smallest possible size and the current line width.
If the symbol number is between 0 and 31, it corresponds to the symbols
shown in Figure E.7 ;
between 33 and 127, the symbol corresponds to the ASCII
character in the currently selected font;
and larger than 127, it corresponds to
the Hershey symbol
of the same number
(see section E.8).
If a fractional part of a PSTYLE item exists,
then it is treated as a fractional expansion of the symbol size
(fractional parts less than 0.01 are treated as no fractional expansion).
In addition, the command points
uses the ERR array to determine which color index to use to draw
each point.
The commands lcur, ncurse, and olin use the cursor to
add and delete points from the current X and Y arrays.
The keystroke commands used by these commands are different from the
interactive commands available with the
cursor command.
With these commands, the (case independent) keystroke commands are
described in the list that follows:
- A --
- Add a point at the current cursor location.
- D --
- Remove either the last point entered (lcur
and olin) or the point closest to the current cursor
location (ncurse).
- X --
- Exit the interactive part of the command.
NOTE: Many devices with a 3-button mouse have the keys
`A', `D', and `X' bound (assigned) to the left, middle,
and right buttons, respectively.
Next: 5 Images
Up: Part I: General Concepts
Previous: 3 General Graphics Concepts
morgan@astro.umd.edu