pslegend - Plot legends on maps
pslegend [ textfile ] -D[x]lon/lat/width[/height]/just[/dx/dy] [ -B[p|s]parameters ] [ -Cdx/dy ] [ -F[+gfill][+i[[gap/]*pen*]][+p[pen]][+r[radius]][+s[[dx/dy/][shade]]] ] [ -Jparameters ] [ -K ] [ -Lspacing ] [ -O ] [ -P ] [ -Rwest/east/south/north[r] ] [ -U[just/dx/dy/][c|label] ] [ -V[level] ] [ -X[a|c|f|r][x-shift[u]] ] [ -Y[a|c|f|r][y-shift[u]] ] [ -ccopies ] [ -p[x|y|z]azim/elev[/zlevel][+wlon0/lat0[/z0]][+vx0/y0] ] [ -t[transp] ]
Note: No space is allowed between the option flag and the associated arguments.
pslegend will make legends that can be overlaid on maps. It reads specific legend-related information from an input file [or stdin]. Unless otherwise noted, annotations will be made using the primary annotation font and size in effect (i.e., FONT_ANNOT_PRIMARY)
-X[a|c|f|r][x-shift[u]]
When attributes are not provided, or extended symbol information (for symbols taking more than just an overall size) are not given as comma-separated quantities, pslegend will provide the following defaults:
Front: Front symbol is left-side (here, that means upper side) box, with dimensions 30% of the given symbol size.
Vector: Head size is 30% of given symbol size.
Ellipse: Minor axis is 65% of major axis (the symbol size), with an azimuth of 0 degrees.
Rectangle: Height is 65% of width (the symbol size).
Rotated rectangle: Same, with a rotation of 30 degrees.
Rounded rectangle: Same as rectangle, but with corner radius of 10% of width.
Mathangle: Angles are -10 and 45 degrees, with arrow head size 30% of symbol size.
Wedge: Angles are -30 and 30 degrees.
To add an example of a legend to a Mercator plot (map.ps) with the given specifications, use
gmt pslegend -R-10/10/-10/10 -JM6i -F+gazure1 -Dx0.5i/0.5i/5i/3.3i/BL -C0.1i/0.1i -L1.2 -B5f1 << EOF >> map.ps
# Legend test for pslegend
# G is vertical gap, V is vertical line, N sets # of columns, D draws horizontal line.
# H is header, L is label, S is symbol, T is paragraph text, M is map scale.
#
G -0.1i
H 24 Times-Roman My Map Legend
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 e 0.15i 255/255/0 0.25p 0.3i This ellipse is yellow
S 0.1i w 0.15i 0/255/0 0.25p 0.3i This wedge is green
S 0.1i f 0.25i/-1/0.075ilb 0/0/255 0.25p 0.3i This is a fault
S 0.1i - 0.15i - 0.25tap 0.3i A contour
S 0.1i v 0.25i/0.02i/0.06i/0.05i 255/0/255 0.25p 0.3i This is a vector
S 0.1i i 0.15i 0/255/255 0.25p 0.3i This triangle is boring
V 0 1p
D 0.2i 1p
N 1
M 5 5 600+u f
G 0.05i
I SOEST_logo.ras 3i CT
G 0.05i
B colors.cpt 0.2i 0.2i
G 0.05i L 9 4 R Smith et al., @%5%J. Geophys. Res., 99@%%, 2000
G 0.1i
P
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 have to adjust the box height to get the right size box.
EOF
As -D suggests, leaving the height off forces a calculation of the expected height. This is an exact calculation except in the case of legends that place paragraph text. Here we simply do a first-order estimate of how many typeset lines might appear. Without access to font metrics this estimate will occasionally be off by 1 line. If so, note the reported height (with -V) and specify a slightly larger or smaller height in -D.
Note that under Windows, the percent sign (%) is a variable indicator (like $ under Unix). To indicate a plain percentage sign in a batch script you need to repeat it (%%); hence the font switching mechanism (@%*font*% and @%%) may require twice the number of percent signs. This only applies to text inside a script or that otherwise is processed by DOS. Data files that are opened and read by pslegend do not need such duplication.