1PSLEGEND(1) Generic Mapping Tools PSLEGEND(1)
2
3
4
6 pslegend - To plot a map legend
7
9 pslegend textfile -D[x]lon/lat/width/height/just -Jparameters
10 -Rwest/east/south/north[r] [ -B[p|s]parameters ] [ -Cdx/dy ] [ -F ] [
11 -Gfill ] [ -K ] [ -Lspacing ] [ -O ] [ -P ] [ -S[script] ] [
12 -U[just/dx/dy/][c|label] ] [ -V ] [ -X[a|c|r][x-shift[u]] ] [ -ccopies
13 ] [ -Y[a|c|r][y-shift[u]] ]
14
16 pslegend will make legends that can be overlaid on maps. It reads spe‐
17 cific legend-related information from an input file [or stdin].
18 Because all the elements of the legend can already be created with
19 other tools (psxy, pstext) we use those tools by creating a batch job
20 of commands that are executed to make the final PostScript overlay.
21 Because of this process, the option exists to just output the script
22 which can then be fine-tuned manually. Unless otherwise noted, annota‐
23 tions will be made using the annotation font and size in effect.
24
25 textfile
26 This file contains instruction for the layout of items in the
27 legend. Each legend item is described by a unique record. All
28 records begin with a unique character that is common to all
29 records of the same kind. The order of the legend items is
30 implied by the order of the records. Ten different record types
31 are recognized, and the syntax for each of these records are
32 presented below:
33
34 # comment Records starting with # and blank lines are skipped.
35
36 B cptname offset height [ optional arguments ]
37 The B record will plot a horizontal color bar, psscale-
38 style in the middle, starting at offset from the left
39 edge, and of the given height. You may add any addi‐
40 tional psscale options from the list: -A -B -E -I -L -M
41 -N -S and -Z.
42
43 C textcolor
44 The C record specifies the color with which the remaining
45 text is to be printed. textcolor can be in the form
46 r/g/b, c/m/y/k, or a named color.
47
48 D offset pen
49 The D record results in a horizontal line with specified
50 pen across the legend with one quarter of the line spac‐
51 ing left blank above and below the line. Two gaps of
52 offset units are left blank between the horizontal line
53 and the left and right frame sides. (See SPECIFYING PENS
54 below).
55
56 G gap The G record specifies a vertical gap of the given
57 length. In addition to the standard units (i, c, p) you
58 may use l for lines.
59
60 H fontsize|- font|- header
61 The H record plots a centered text string using the spec‐
62 ified font parameters. Use - to default to
63 HEADER_FONT_SIZE and HEADER_FONT.
64
65 I imagefile width justification
66 Place an EPS or Sun raster image in the legend justified
67 relative to the current point. The image width deter‐
68 mines the size of the image on the page.
69
70 L fontsize|- font|- justification label
71 The L record plots a (L)eft, (C)entered, or (R)ight-jus‐
72 tified text string within a column using the specified
73 font parameters. Use - to default to LABEL_FONT_SIZE and
74 LABEL_FONT.
75
76 M slon|- slat length f|p [ -Rw/e/s/n -Jparam ]
77 Place a map scale in the legend. Specify slon slat, the
78 point on the map where the scale applies (slon is only
79 meaningful for certain oblique projections. If not
80 needed, you must specify - instead), length, the length
81 of the scale in km (append m or n for miles or nautical
82 miles), and f or p for fancy or plain scale. If the -R
83 -J supplied to pslegend is different than the projection
84 needed for the scale, supply the optional -R -J settings
85 as well. Append +l to the length to select the default
86 label which equals the distance unit (km, miles, nautical
87 miles) and is justified on top of the scale [t]. Change
88 this by giving your own label (append +llabel). Change
89 label justification with +jjustification (choose among
90 l(eft), r(ight), t(op), and b(ottom)). Apply +u to
91 append the unit to all distance annotations along the
92 scale. If you want to place a rectangle behind the
93 scale, specify suitable +ppen and/or +ffill parameters.
94 All these +modifiers are appended to length to make a
95 single string. (See SPECIFYING PENS and SPECIFYING FILL
96 below).
97
98 N ncolumns
99 Change the number of columns in the legend [1]. This only
100 affects the printing of symbols (S) and labels (L).
101
102 S dx1 symbol size fill pen [ dx2 text ]
103 Plots the selected symbol with specified size, fill, and
104 outline (see psxy). The symbol is centered at dx1 from
105 the left margin of the column, with the optional explana‐
106 tory text starting dx2 from the margin, printed with
107 fontsize ANNOT_FONT_SIZE_PRIMARY and font ANNOT_FONT_PRI‐
108 MARY. Use - if no fill or outline (pen) is required.
109 When plotting just a symbol, without text, dx2 and text
110 can be omitted. Two psxy symbols require special atten‐
111 tion: front (f) and vector (v). You must prepend the
112 length of the desired item to the rest of the symbol
113 argument; this will be used internally to set the correct
114 fault or vector length and will be stripped before pass‐
115 ing the arguments to psxy.
116
117 T paragraph-text
118 One or more of these T records with paragraph-text
119 printed with fontsize ANNOT_FONT_SIZE_PRIMARY and font
120 ANNOT_FONT_PRIMARY (aligned and wrapped). To specify
121 special positioning and typesetting arrangements, or to
122 enter a paragraph break, use the optional > record.
123
124 V offset pen
125 The V record draws a vertical line between columns (if
126 more than one) using the selected pen (See SPECIFYING
127 PENS below). offset is analogous to the offset for the D
128 records but in the vertical direction.
129
130 > paragraph-mode-header-for-pstext
131 Start a new text paragraph by specifying all the parame‐
132 ters needed (see pstext -m description). Note that psle‐
133 gend knows what all those values should be, so normally
134 you can leave the entire record (after >) blank or leave
135 it out all together. If you need to set at least one of
136 the parameters directly, you must specify all and set the
137 ones you want to leave at their default value to -.
138
139 -D Positions the legend and specifies its size. The just is a
140 2-char justification string (see pstext) that relates the given
141 position to a point on the rectangular legend box. If you want
142 to specify the position in map plot units (i.e., inches or cm),
143 use -Dx.
144
145 -J Selects the map projection. Scale is UNIT/degree, 1:xxxxx, or
146 width in UNIT (upper case modifier). UNIT is cm, inch, or m,
147 depending on the MEASURE_UNIT setting in .gmtdefaults4, but this
148 can be overridden on the command line by appending c, i, or m to
149 the scale/width value. When central meridian is optional,
150 default is center of longitude range on -R option. Default
151 standard parallel is the equator. For map height, max dimen‐
152 sion, or min dimension, append h, +, or - to the width, respec‐
153 tively.
154 More details can be found in the psbasemap man pages.
155
156 CYLINDRICAL PROJECTIONS:
157
158 -Jclon0/lat0/scale (Cassini)
159 -Jcyl_stere/[lon0/[lat0/]]scale (Cylindrical Stereographic)
160 -Jj[lon0/]scale (Miller)
161 -Jm[lon0/[lat0/]]scale (Mercator)
162 -Jmlon0/lat0/scale (Mercator - Give meridian and standard paral‐
163 lel)
164 -Jo[a]lon0/lat0/azimuth/scale (Oblique Mercator - point and
165 azimuth)
166 -Jo[b]lon0/lat0/lon1/lat1/scale (Oblique Mercator - two points)
167 -Joclon0/lat0/lonp/latp/scale (Oblique Mercator - point and
168 pole)
169 -Jq[lon0/[lat0/]]scale (Cylindrical Equidistant)
170 -Jtlon0/[lat0/]scale (TM - Transverse Mercator)
171 -Juzone/scale (UTM - Universal Transverse Mercator)
172 -Jy[lon0/[lat0/]]scale (Cylindrical Equal-Area)
173
174 CONIC PROJECTIONS:
175
176 -Jblon0/lat0/lat1/lat2/scale (Albers)
177 -Jdlon0/lat0/lat1/lat2/scale (Conic Equidistant)
178 -Jllon0/lat0/lat1/lat2/scale (Lambert Conic Conformal)
179 -Jpoly/[lon0/[lat0/]]scale ((American) Polyconic)
180
181 AZIMUTHAL PROJECTIONS:
182
183 -Jalon0/lat0[/horizon]/scale (Lambert Azimuthal Equal-Area)
184 -Jelon0/lat0[/horizon]/scale (Azimuthal Equidistant)
185 -Jflon0/lat0[/horizon]/scale (Gnomonic)
186 -Jglon0/lat0[/horizon]/scale (Orthographic)
187 -Jglon0/lat0/altitude/azimuth/tilt/twist/Width/Height/scale
188 (General Perspective).
189 -Jslon0/lat0[/horizon]/scale (General Stereographic)
190
191 MISCELLANEOUS PROJECTIONS:
192
193 -Jh[lon0/]scale (Hammer)
194 -Ji[lon0/]scale (Sinusoidal)
195 -Jkf[lon0/]scale (Eckert IV)
196 -Jk[s][lon0/]scale (Eckert VI)
197 -Jn[lon0/]scale (Robinson)
198 -Jr[lon0/]scale (Winkel Tripel)
199 -Jv[lon0/]scale (Van der Grinten)
200 -Jw[lon0/]scale (Mollweide)
201
202 NON-GEOGRAPHICAL PROJECTIONS:
203
204 -Jp[a]scale[/origin][r|z] (Polar coordinates (theta,r))
205 -Jxx-scale[d|l|ppow|t|T][/y-scale[d|l|ppow|t|T]] (Linear, log,
206 and power scaling)
207
208 -R xmin, xmax, ymin, and ymax specify the Region of interest. For
209 geographic regions, these limits correspond to west, east,
210 south, and north and you may specify them in decimal degrees or
211 in [+-]dd:mm[:ss.xxx][W|E|S|N] format. Append r if lower left
212 and upper right map coordinates are given instead of w/e/s/n.
213 The two shorthands -Rg and -Rd stand for global domain (0/360
214 and -180/+180 in longitude respectively, with -90/+90 in lati‐
215 tude). Alternatively, specify the name of an existing grid file
216 and the -R settings (and grid spacing, if applicable) are copied
217 from the grid. For calendar time coordinates you may either
218 give (a) relative time (relative to the selected TIME_EPOCH and
219 in the selected TIME_UNIT; append t to -JX|x), or (b) absolute
220 time of the form [date]T[clock] (append T to -JX|x). At least
221 one of date and clock must be present; the T is always required.
222 The date string must be of the form [-]yyyy[-mm[-dd]] (Gregorian
223 calendar) or yyyy[-Www[-d]] (ISO week calendar), while the clock
224 string must be of the form hh:mm:ss[.xxx]. The use of delim‐
225 iters and their type and positions must be exactly as indicated
226 (however, input, output and plot formats are customizable; see
227 gmtdefaults).
228
230 No space between the option flag and the associated arguments.
231
232 -B Sets map boundary annotation and tickmark intervals; see the
233 psbasemap man page for all the details.
234
235 -C Sets the clearance between the legend frame and the internal
236 items [0.15c/0.15c (or 0.05i/0.05i)].
237
238 -F Draws a border around the legend using FRAME_PEN.
239
240 -G Select fill shade, color or pattern of the legend box [Default
241 is no fill]. (See SPECIFYING FILL below).
242
243 -K More PostScript code will be appended later [Default terminates
244 the plot system].
245
246 -L Sets the linespacing factor in units of the current annotation
247 font size [1.1].
248
249 -O Selects Overlay plot mode [Default initializes a new plot sys‐
250 tem].
251
252 -P Selects Portrait plotting mode [Default is Landscape, see gmtde‐
253 faults to change this].
254
255 -S Instead of writing the PostScript plot [Default], output the GMT
256 script used to make the legend to standard output, or optionally
257 to the file script.
258
259 -U Draw Unix System time stamp on plot. By adding just/dx/dy/, the
260 user may specify the justification of the stamp and where the
261 stamp should fall on the page relative to lower left corner of
262 the plot. For example, BL/0/0 will align the lower left corner
263 of the time stamp with the lower left corner of the plot.
264 Optionally, append a label, or c (which will plot the command
265 string.). The GMT parameters UNIX_TIME, UNIX_TIME_POS, and
266 UNIX_TIME_FORMAT can affect the appearance; see the gmtdefaults
267 man page for details. The time string will be in the locale set
268 by the environment variable TZ (generally local time).
269
270 -V Selects verbose mode, which will send progress reports to stderr
271 [Default runs "silently"].
272
273 -X -Y Shift plot origin relative to the current origin by (x-shift,y-
274 shift) and optionally append the length unit (c, i, m, p). You
275 can prepend a to shift the origin back to the original position
276 after plotting, or prepend r [Default] to reset the current
277 origin to the new location. If -O is used then the default (x-
278 shift,y-shift) is (0,0), otherwise it is (r1i, r1i) or (r2.5c,
279 r2.5c). Alternatively, give c to align the center coordinate (x
280 or y) of the plot with the center of the page based on current
281 page size.
282
283 -c Specifies the number of plot copies. [Default is 1].
284
285 SPECIFYING PENS
286 pen The attributes of lines and symbol outlines as defined by pen is
287 a comma delimetered list of width, color and texture, each of
288 which is optional. width can be indicated as a measure (points,
289 centimeters, inches) or as faint, thin[ner|nest], thick[er|est],
290 fat[ter|test], or obese. color specifies a gray shade or color
291 (see SPECIFYING COLOR below). texture is a combination of
292 dashes `-' and dots `.'.
293
294 SPECIFYING FILL
295 fill The attribute fill specifies the solid shade or solid color (see
296 SPECIFYING COLOR below) or the pattern used for filling poly‐
297 gons. Patterns are specified as pdpi/pattern, where pattern
298 gives the number of the built-in pattern (1-90) or the name of a
299 Sun 1-, 8-, or 24-bit raster file. The dpi sets the resolution
300 of the image. For 1-bit rasters: use Pdpi/pattern for inverse
301 video, or append :Fcolor[B[color]] to specify fore- and back‐
302 ground colors (use color = - for transparency). See GMT Cook‐
303 book & Technical Reference Appendix E for information on indi‐
304 vidual patterns.
305
306 SPECIFYING COLOR
307 color The color of lines, areas and patterns can be specified by a
308 valid color name; by a gray shade (in the range 0-255); by a
309 decimal color code (r/g/b, each in range 0-255; h-s-v, ranges
310 0-360, 0-1, 0-1; or c/m/y/k, each in range 0-1); or by a hexa‐
311 decimal color code (#rrggbb, as used in HTML). See the gmtcol‐
312 ors manpage for more information and a full list of color names.
313
315 To add an example of a legend to a Mercator plot (map.ps) with the
316 given specifications, use
317
318 pslegend -R-10/10/-10/10 -JM6i -Gazure1 -Dx0.5i/0.5i/5i/3.3i/BL
319 -C0.1i/0.1i -L1.2 -F -B5f1 << EOF >> map.ps
320 G -0.1i
321 H 24 Times-Roman My Map Legend
322 D 0.2i 1p
323 N 2
324 V 0 1p
325 S 0.1i c 0.15i p300/12 0.25p 0.3i This circle is hachured
326 S 0.1i e 0.15i 255/255/0 0.25p 0.3i This ellipse is yellow
327 S 0.1i w 0.15i 0/255/0 0.25p 0.3i This wedge is green
328 S 0.1i f 0.25i/-1/0.075ilb 0/0/255 0.25p 0.3i This is a fault
329 S 0.1i - 0.15i - 0.25tap 0.3i A contour
330 S 0.1i v 0.25i/0.02i/0.06i/0.05i 255/0/255 0.25p 0.3i This is a vector
331 S 0.1i i 0.15i 0/255/255 0.25p 0.3i This triangle is boring
332 V 0 1p
333 D 0.2i 1p
334 N 1
335 M 5 5 600+u f
336 G 0.05i
337 I SOEST_logo.ras 3i CT
338 G 0.05i
339 B colors.cpt 0.2i 0.2i
340 G 0.05i L 9 4 R Smith et al., @%5%J. Geophys. Res., 99@%%, 2000
341 G 0.1i
342 T Let us just try some simple text that can go on a few lines.
343 T There is no easy way to predetermine how many lines will be required,
344 T so we may have to adjust the box height to get the right size box.
345 EOF
346
348 Note that under Windows, the percent sign (%) is a variable indicator
349 (like $ under Unix). To indicate a plain percentage sign in a batch
350 script you need to repeat it (%%); hence the font switching mechanism
351 (@%font% and @%%) may require twice the number of percent signs. This
352 only applies to text inside a script or that otherwise is processed by
353 DOS. Data files that are opened and read by pslegend do not need such
354 duplication.
355
357 GMT(1), gmtcolors(5), gmtdefaults(1), psbasemap(1), pstext(1), psxy(1)
358
359
360
361GMT 4.5.6 10 Mar 2011 PSLEGEND(1)