next up previous contents index
Next: Specifying pen attributes Up: SESSION TWO Previous: SESSION TWO

General Information

There are 17 GMT programs that directly create or modify plots (Table 2.1); the remaining 43 are mostly concerned with data processing. This session will focus on the task of plotting lines, symbols, and text on maps. We will build on the skills we acquired while familiarizing ourselves with the various GMT map projections as well as how to select a data domain and boundary annotations.


 
Table 2.1: List of all 1-D and 2-D plotting programs in GMT
Program Purpose
BASEMAPS
psbasemap  Create an empty basemap frame with optional scale
pscoast  Plot coastlines, filled continents, rivers, and political borders
POINTS AND LINES
pswiggle  Draw spatial time-series along their (x,y)-tracks
psxy  Plot symbols, polygons, and lines in 2-D
psxyz  Plot symbols, polygons, and lines in 3-D
HISTOGRAMS
pshistogram  Plot a rectangular histogram
psrose  Plot a polar histogram(sector/rose diagram)
CONTOURS
grdcontour  Contouring of 2-D gridded data sets
pscontour  Direct contouring or imaging of xyz data by optimal triangulation
SURFACES
grdimage  Produce color images from 2-D gridded data
grdvector  Plot vector fields from 2-D gridded data
grdview  3-D perspective imaging of 2-D gridded data
UTILITIES
psclip  Use polygon files to initiate custom clipping paths
psimage  Plot Sun rasterfiles
psmask  Create clipping paths or generate overlay to mask
psscale  Plot grayscale or colorscale bar
pstext  Plot textstrings on maps
 

Plotting lines and symbols, psxy  is one of the most frequently used programs in GMT. In addition to the common command line switches it has numerous specific options, and expects different file formats depending on what symbol has been selected. These circumstances makes psxy  harder to master than most GMT tools. Table 2.2 shows a complete list of the options.


 
Table 2.2: Optional switches in the psxy  program
Option Purpose
-–A Suppress line interpolation along great circles
-–C cpt Let symbol color be determined from z-values and the cpt file
-–E[ x][ y][ cap][/ pen] Draw selected error bars with specified attributes
-–G fill Set color for symbol or fill for polygons
-–L Explicitly close polygons
-–M[ flag] Multiple segment input data; headers start with flag
-–N Do Not clip symbols at map borders
-–S[symbol][ size] Select one of 15 symbols (See Table 2.3)
-–W pen Set pen for line or symbol outline
 

The symbols can either be transparent (using -–W only, not -–G) or solid (-–G, with optional outline using -–W). The -–S option takes the code for the desired symbol and optional size information. If no symbol is given it is expected to be in the last column of the input file. The size is optional since individual sizes for symbols may be provided by the input data. The 15 symbols available to us are


 
Table: The symbol option in psxy . Lower case symbols ( a, c, d, h, i, s, t, x) will fit inside a circle of given diameter. Upper case symbols ( A, C, D, H, I, S, T, X) will have area equal to that of a circle of given diameter.
   
Option Symbol
-–Sa size st ar; size is radius of circumscribing circle
-–Sb size[/ base][ u] bar; size is bar width, append u if size is in x-units.
  Bar extends from base [0] to the y-value.
-–Sc size circle; size is the diameter
-–Sd size diamond; size is its side
-–Se ellipse; direction (CCW from horizontal), major, and minor axes in inches
  are read from the input file
-–SE ellipse; azimuth (CW from vertical), major, and minor axes in kilometers
  are read from the input file
-–Sf gap/ tick[ l|L|r|R] fault; gap and tick set length of and distance between ticks.
  If gap < 0 it means the number of ticks. l or r will draw ticks to left or right
  side of line [Default is centered].
  Use upper case L or R to draw triangles instead of ticks.
-–Sh size hexagon; size is its side
-–Si size inverted triangle; size is its side
-–Sl size/ string letter; size is fontsize. Append a letter or text string
-–Sp point; no size needed (1 pixel at current resolution is used)
-–Ss size square, size is its side
-–St size triangle; size is its side
-–Sv[ thick/ length/ width][ n norm] vector; direction (CCW from horizontal) and length are read from input data.
  Optionally, append the thickness of the vector and the width and length of the
  arrow-head. If the n norm is appended, all vectors whose lengths are less than
  norm will have their attributed scaled by length/ norm.
-–SV[ thick/ length/ width][ n norm] vector, except azimuth (degrees east of north) is expected instead of direction
  The angle on the map is calculated based on the chosen map projection.
-–Sx size cross; size is length of crossing lines
 

Because some symbols require more input data than others, and because the size of symbols as well as their color can be determined from the input data, the format of data can be confusing. The general format for the input data is (optional items are in brackets []):
 

$x\mbox{ } y$ [ z ] [ size ] [ $\sigma_x$ ] [ $\sigma_y$ ] [ symbol ]

The only required input columns are the first two which must contain the longitude and latitude (or x and y). The remaining items apply when one (or more) of the following conditions are met:

1.
If you want the color of each symbol to be determined individually, supply a cptfile with the -–C option and let the 3rd data column contain the z-values to be used with the cptfile.

2.
If you want the size of each symbol to be determined individually, append the size in a separate column.

3.
To draw error bars, use the -–E option and give one or two additional data columns with the $\pm dx$ and $\pm dy$ values; the form of -–E determines if one (-–Ex or -–Ey) or two (-–Exy) columns are needed.  

4.
If you draw vectors with -–Sv (or -–SV) then size is actually two columns containing the direction (or azimuth) and length of each vector.  

5.
If you draw ellipses (-–Se) then size is actually three columns containing the direction and the major and minor axes in inches (with -–SE we expect azimuth instead and axes in km).  

Before we try some examples we need to discuss two key switches; they specify pen attributes and symbol or polygon fill.



 
next up previous contents index
Next: Specifying pen attributes Up: SESSION TWO Previous: SESSION TWO
Paul Wessel
1999-07-01