PSLEGEND

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
EXAMPLES
SEE ALSO

NAME

pslegend − To plot a map legend

SYNOPSIS

pslegend textfile −D[x]lon/lat/width/height/just −Jparameters −Rwest/east/south/north[r] [ −Cdx/dy ] [ −F ] [ −Gfill ] [ −K ] [ −Lspacing ] [ −O ] [ −P ] [ −S[script] ] [ −U[/dx/dy/][label] ] [ −V ] [ −X[a|c|r][x-shift[u]] ] [ −ccopies ] [ −Y[a|c|r][y-shift[u]] ]

DESCRIPTION

pslegend will make legends that can be overlaid on maps. It reads specific legend-related information from an input file [or stdin]. Because all the elements of the legend can already be created with other tools (psxy, pstext) we use those tools by creating a batch job of commands that are executed to make the final PostScript overlay. Because of this process, the option exists to just output the script which can then be fine-tuned manually. Unless otherwise noted, annotations will be made using the annotation font and size in effect.

textfile

This file contains instruction for the layout of items in the legend. Each legend item is described by a unique record. All records begin with a unique character that is common to all records of the same kind. The order of the legend items is implied by the order of the records. Ten different record types are recognized, and the syntax for each of these records are presented below:

# Comment records

Records starting with # and blank lines are skipped.

B cptname offset height [ optional arguments ]

The B record will plot a horizontal color bar, psscale-style in the middle, starting at offset from the left edge, and of the given height. You may add any additional psscale options from the list: −A −B −E −I −L −M −N −S and −Z.

C textcolor

The C record specifies the color with which the remaining text is to be printed. textcolor can be in the form r/g/b, c/m/y/k, or a named color.

D offset pen

The D record results in a horizontal line across the legend. The line starts and stops offset units from the frame sides, and is drawn using the specified pen.

G gap

The G record specifies a vertical gap of the given length. In addition to the standard units (i, c, p) you may use l for lines.

H fontsize font Header

The H record plots a centered text string using the specified font parameters.

I imagefile width justification

Place an EPS or Sun raster image in the legend justified relative to the current point. The image width determines the size of the image on the page.

L fontsize font justification Label

The L record plots a (L)eft, (C)entered, or (R)ight-justified text string using the specified font parameters.

M slon|- slat length f|p [ −Rw/e/s/n −Jparam ]

Place a map scale in the legend. Specify slon slat, the point on the map where the scale applies (slon is only meaningful for certain oblique projections. If not needed, you must specify - instead), length, the length of the scale in km (append m or n for miles or nautical miles), and f|p for fancy or plain scale. If the −R −J supplied to pslegend is different than the projection needed for the scale, supply the optional −R −J settings as well. Note that length can have :label:just appended, where label replaces the default label (unless - is given) and just (l|r|t|b) dictates where the label is placed [Default is t]. Use u to treat the label as distance units appended to each annotation.

N ncolums

Change the number of columns in the legend [1].

S dx1 symbol size fill pen dx2 text

Plots the selected symbol with specified size, fill, and outline. The symbol is centered at dx1 from the left margin of the column, with the explanatory text starting dx2 from the margin. Use - if no fill is required. Two psxy symbols front (f) and vector (v) require special attention. You must prepend the length of the desired item to the rest of the symbol argument; this will be used internally to set the correct fault or vector length and will be stripped before passing the arguments to psxy.

> <paragraph mode header for pstext>

Start a new text paragraph by specifying all the parameters needed (see pstext −M description). Note that pslegend knows what all those values should be, so normally you can leave the entire record (after >) blank. If you need to set at least one of the parameters directly, you must specify all and set the ones you want to leave at their default value to -.

T paragraph-text

One or more of these T records with text must follow after the > record.

V offset pen

The V record draws a vertical line between columns (if more than one) using the selected pen. offset is analogous to the offset for the D records but in the vertical direction.

−D

Positions the legend and specifies its size. The just is a 2-char justification string (see pstext) that relates the given position to a point on the rectangular legend box. If you want to specify the position in projected units (i.e., inches or cm), use −Dx.

−J

Selects the map projection. Scale is UNIT/degree, 1:xxxxx, or width in UNIT (upper case modifier). UNIT is cm, inch, or m, depending on the MEASURE_UNIT setting in .gmtdefaults4, but this can be overridden on the command line by appending c, i, or m to the scale/width value. For map height, max dimension, or min dimension, append h, +, or - to the width, respectively.

More details can be found in the psbasemap man pages.

CYLINDRICAL PROJECTIONS:

−Jclon0/lat0/scale (Cassini)
−Jj
lon0/scale (Miller)
−Jm
scale (Mercator - Greenwich and Equator as origin)
−Jm
lon0/lat0/scale (Mercator - Give meridian and standard parallel)
−Joa
lon0/lat0/azimuth/scale (Oblique Mercator - point and azimuth)
−Job
lon0/lat0/lon1/lat1/scale (Oblique Mercator - two points)
−Joc
lon0/lat0/lonp/latp/scale (Oblique Mercator - point and pole)
−Jq
lon0/scale (Equidistant Cylindrical Projection (Plate Carree))
−Jt
lon0/scale (TM - Transverse Mercator, with Equator as y = 0)
−Jt
lon0/lat0/scale (TM - Transverse Mercator, set origin)
−Ju
zone/scale (UTM - Universal Transverse Mercator)
−Jy
lon0/lats/scale (Basic Cylindrical Projection)

AZIMUTHAL PROJECTIONS:

−Jalon0/lat0/scale (Lambert)
−Je
lon0/lat0/scale (Equidistant)
−Jf
lon0/lat0/horizon/scale (Gnomonic)
−Jg
lon0/lat0/scale (Orthographic)
−Js
lon0/lat0/[slat/]scale (General Stereographic)

CONIC PROJECTIONS:

−Jblon0/lat0/lat1/lat2/scale (Albers)
−Jd
lon0/lat0/lat1/lat2/scale (Equidistant)
−Jl
lon0/lat0/lat1/lat2/scale (Lambert)

MISCELLANEOUS PROJECTIONS:

−Jhlon0/scale (Hammer)
−Ji
lon0/scale (Sinusoidal)
−Jk
[f|s]lon0/scale (Eckert IV (f) and VI (s))
−Jn
lon0/scale (Robinson)
−Jr
lon0/scale (Winkel Tripel)
−Jv
lon0/scale (Van der Grinten)
−Jw
lon0/scale (Mollweide)

NON-GEOGRAPHICAL PROJECTIONS:

−Jp[a]scale[/origin][r|z] (Polar coordinates (theta,r))
−Jx
x-scale[d|l|ppow|t|T][/y-scale[d|l|ppow|t|T]] (Linear, log, and power scaling)

−R

xmin, xmax, ymin, and ymax specify the Region of interest. For geographic regions, these limits correspond to west, east, south, and north and you may specify them in decimal degrees or in [+-]dd:mm[:ss.xxx][W|E|S|N] format. Append r if lower left and upper right map coordinates are given instead of wesn. The two shorthands −Rg −Rd stand for global domain (0/360 or -180/+180 in longitude respectively, with -90/+90 in latitude). For calendar time coordinates you may either give relative time (relative to the selected TIME_EPOCH and in the selected TIME_UNIT; append t to −JX|x), or absolute time of the form [date]T[clock] (append T to −JX|x). At least one of date and clock must be present; the T is always required. The date string must be of the form [-]yyyy[-mm[-dd]] (Gregorian calendar) or yyyy[-Www[-d]] (ISO week calendar), while the clock string must be of the form hh:mm:ss[.xxx]. The use of delimiters and their type and positions must be as indicated (however, input/output and plotting formats are flexible).

OPTIONS

No space between the option flag and the associated arguments.

−C

Sets the clearance between the legend frame and the internal items [0.15c/0.15c (or 0.05i/0.05i)].

−F

Draws a border around the legend using FRAME_PEN.

−G

Specify the grey shade (0−255) or color (r/g/b, each in range 0−255; h-s-v, ranges 0−360, 0−1, 0−1; or c/m/y/k, each in range 0−100%; or valid color name). Alternatively, specify −Gpdpi/pattern, where pattern gives the number of the built-in pattern (1-90) or the name of a Sun 1-, 8-, or 24-bit raster file. The dpi sets the resolution of the image. For 1-bit rasters: use −GP for inverse video, or append :Fcolor[B[color]] to specify fore- and background colors (use color = - for transparency). See GMT Cookbook & Technical Reference Appendix E for information on individual patterns.

−K

More PostScript code will be appended later [Default terminates the plot system].

−L

Sets the linespacing factor in units of the current annotation font size [1.1].

−O

Selects Overlay plot mode [Default initializes a new plot system].

−P

Selects Portrait plotting mode [GMT Default is Landscape, see gmtdefaults to change this].

−S

Instead of writing the PostScript plot [Default], output the GMT script used to make the legend to standard output, or optionally to the file script.

−U

Draw Unix System time stamp on plot. User may specify where the lower left corner of the stamp should fall on the page relative to lower left corner of plot. Optionally, append a label, or c (which will plot the command string.). The GMT parameters UNIX_TIME and UNIX_TIME_POS can affect the appearance; see the gmtdefaults man page for details.

−V

Selects verbose mode, which will send progress reports to stderr [Default runs "silently"].

−X −Y

Shift origin of plot by (x-shift,y-shift), and opetionally append units (c, i, m, p). Prepend a for absolute coordinates; the default (r) will reset plot origin. Give c to center plot using current page size.

−c

Specifies the number of plot copies. [Default is 1].

EXAMPLES

To add an example of a legend to a Mercator plot (map.ps) with the given specifications, use

pslegend −R-10/10/-10/10 −JM4i −G255 −D0/0/4i/3i/BL << EOF >> map.ps
G -0.15i
H 24 Times-Roman My Map Legend
G 0.05i
D 0.2i 1p
N 2
V 0 1p
S 0.1i c 0.15i p300/12 0.25p 0.3i This circle is hachured
S 0.1i t 0.15i yellow 0.25p 0.3i This triangle is yellow
S 0.1i h 0.15i green 0.25p 0.3i This hexagon is green
S 0.1i d 0.15i blue 0.25p 0.3i This diamond is blue
S 0.1i - 0.15i - 0.25tap 0.3i A contour
V 0 1p
D 0.2i 1p
N 1
I SOEST_logo.ras 3 CT
L 9 4 R Smith et al., @%5%J. Geophys. Res., 99@%%, 2000
G 0.5i
>
T Let us just try some simple text that can go on a few lines.
T There is no easy way to predetermine how many lines will be required,
T so we may need to adjust the box height to get the right size.
G -0.3i
M 5 5 1000:km:l f
EOF

SEE ALSO

GMT(l), psbasemap(l), pstext(l), psxy(l)