Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

legend_common.rst_ 14 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
  1. |No-spaces|
  2. Description
  3. -----------
  4. Makes legends that can be overlaid on maps. It reads
  5. specific legend-related information from an input file [or stdin].
  6. Unless otherwise noted, annotations will be made using the primary
  7. annotation font and size in effect (i.e., :term:`FONT_ANNOT_PRIMARY`)
  8. Required Arguments
  9. ------------------
  10. .. _-D:
  11. **-D**\ [**g**\|\ **j**\|\ **J**\|\ **n**\|\ **x**]\ *refpoint*\ **+w**\ *width*\ [/*height*]\ [**+j**\ *justify*]\ [**+l**\ *spacing*]\ [**+o**\ *dx*\ [/*dy*]]
  12. Defines the reference point on the map for the legend using one of four coordinate systems:
  13. .. include:: explain_refpoint.rst_
  14. Append **+w**\ *width*\ [/*height*] to set
  15. the width (and height) of the legend box in plot coordinates (inches, cm, etc.).
  16. If *height* is zero or not given then we estimate *height* based the expected
  17. vertical extent of the items to be placed.
  18. By default, the anchor point on the legend is assumed to be the bottom left corner (BL), but this
  19. can be changed by appending **+j** followed by a 2-char justification code *justify* (see :doc:`text`).
  20. **Note**: If **-Dj** is used then *justify* defaults to the same as *refpoint*,
  21. if **-DJ** is used then *justify* defaults to the mirror opposite of *refpoint*.
  22. Use **+l**\ *spacing* to change the line-spacing factor in units of the current
  23. font size [1.1].
  24. Optional Arguments
  25. ------------------
  26. .. _-B:
  27. .. include:: explain_-B.rst_
  28. .. _-C:
  29. **-C**\ *dx*/*dy*
  30. Sets the clearance between the legend frame and the internal items [4\ **p**/4\ **p**].
  31. .. _-F:
  32. **-F**\ [**+c**\ *clearances*][**+g**\ *fill*][**+i**\ [[*gap*/]\ *pen*]][**+p**\ [*pen*]][**+r**\ [*radius*]][**+s**\ [[*dx*/*dy*/][*shade*]]]
  33. Without further options, draws a rectangular border around the legend using
  34. :term:`MAP_FRAME_PEN`; specify a different pen with **+p**\ *pen*.
  35. Add **+g**\ *fill* to fill the legend box [no fill].
  36. Append **+c**\ *clearance* where *clearance* is either *gap*, *xgap*\ /\ *ygap*,
  37. or *lgap*\ /\ *rgap*\ /\ *bgap*\ /\ *tgap* where these items are uniform, separate in
  38. x- and y-direction, or individual side spacings between scale and border.
  39. Append **+i** to draw a secondary, inner border as well. We use a uniform
  40. *gap* between borders of 2\ **p** and the :term:`MAP_DEFAULT_PEN`
  41. unless other values are specified. Append **+r** to draw rounded
  42. rectangular borders instead, with a 6\ **p** corner radius. You can
  43. override this radius by appending another value. Finally, append
  44. **+s** to draw an offset background shaded region. Here, *dx*/*dy*
  45. indicates the shift relative to the foreground frame
  46. [4\ **p**/-4\ **p**] and *shade* sets the fill style to use for shading [gray50].
  47. .. _-J:
  48. .. |Add_-J| unicode:: 0x20 .. just an invisible code
  49. .. include:: explain_-J.rst_
  50. .. _-R:
  51. .. |Add_-R| unicode:: 0x20 .. just an invisible code
  52. .. include:: explain_-R.rst_
  53. .. _-S:
  54. **-S**\ *scale*
  55. Scale all symbol sizes by a common *scale* [1].
  56. .. _-T:
  57. **-T**\ *file*
  58. Modern mode only: Write hidden legend specification file to *file*.
  59. .. _-U:
  60. .. include:: explain_-U.rst_
  61. .. _-V:
  62. .. |Add_-V| unicode:: 0x20 .. just an invisible code
  63. .. include:: explain_-V.rst_
  64. .. _-X:
  65. .. include:: explain_-XY.rst_
  66. .. |Add_perspective| unicode:: 0x20 .. just an invisible code
  67. .. include:: explain_perspective.rst_
  68. .. include:: explain_-qi.rst_
  69. .. include:: explain_-t.rst_
  70. .. include:: explain_help.rst_
  71. Legend Codes
  72. ------------
  73. *specfile*
  74. This ASCII file contains instructions for the layout of items in the
  75. legend. Each legend item is described by a unique record. All
  76. records begin with a unique character that is common to all records
  77. of the same kind. The order of the legend items is implied by the
  78. order of the records. Fourteen different record types are recognized, and
  79. the syntax for each of these records are presented below:
  80. **#** *comment*
  81. Records starting with # and blank lines are skipped.
  82. **A** *cptname*
  83. Symbol or cell color fills may be given indirectly via a *z*-value
  84. which can be used for the color look-up via the given CPT *cptname*.
  85. You may switch to other *cptname* by repeating this command.
  86. **B** *cptname offset height* [ *optional arguments* ]
  87. The **B** record will plot a horizontal color bar, :doc:`colorbar`-style
  88. in the middle, starting at *offset* from the left edge, and of the
  89. given *height*. You may add any additional :doc:`colorbar` options as well.
  90. Any of the modifiers
  91. [**+e**\ [**b**\|\ **f**][*length*]][**+h**][**+m**\ [**a**\|\ **c**\|\ **l**\|\ **u**]][**+n**\ [*txt*]] may be
  92. appended to the *height* argument, while other module options
  93. **-B** **-I** **-L** **-M** **-N** **-S** **-Z** and **-p** may be appended as
  94. *optional arguments* at the end of the record.
  95. See :doc:`colorbar` for details on all modifiers and options.
  96. **C** *textcolor*
  97. The **C** record specifies the color with which the remaining text
  98. is to be printed via z=\ *value* (requires a prior **A** code as well).
  99. When **C** is used in a legend then your font specifications cannot also
  100. contain a color specification since we will append ,\ *textcolor* to the font.
  101. Use **-** to reset to default color.
  102. **D** [*offset*] *pen* [**-**\|\ **+**\|\ **=**]
  103. The **D** record results in a horizontal line with specified *pen*
  104. across the legend with one quarter of the line-spacing left blank
  105. above and below the line. Two gaps of *offset* units are left blank
  106. between the horizontal line and the left and right frame sides [0]. If
  107. no pen is given we use :term:`MAP_GRID_PEN_PRIMARY`, and if *pen* is
  108. set to **-** then no visible line is drawn (we just remember the location
  109. as a possible start/stop point for a vertical line; see **V**). To *not* add the
  110. quarter line-spacing before the line, add **-**. To *not* add the spacing
  111. after the line, add **+**. For no spacing at all, add **=**
  112. [Default places a quarter line-spacing both before and after the line].
  113. **F** *fill1 fill2 ... filln*
  114. Specify fill (color of pattern) for cells. Alternatively, you can
  115. specify an indirect color via z=\ *value* (requires a prior **A** code).
  116. If only *fill1* is given
  117. then it is used to fill the entire row, otherwise give one fill value
  118. for each active column (see **N**). If any fill is - then no fill
  119. takes place [Default].
  120. **G** *gap*
  121. The **G** record specifies a vertical gap of the given length. In
  122. addition to the standard units (**i**, **c**, **p**) you may use
  123. **l** for lines. A negative *gap* will move the current line upwards (thus closing a gap).
  124. **H** *font*\|\ **-** *header*
  125. The **H** record plots a centered text string using the specified
  126. font parameters. Use **-** to default to size and fonttype of :term:`FONT_TITLE`.
  127. **I** *imagefile width justification*
  128. Place an EPS or raster image in the legend justified relative to
  129. the current point. The image *width* determines the size of the image on the page.
  130. **L** *font*\|\ **-** *justification label*
  131. The **L** record plots a (L)eft, (C)entered, or (R)ight-justified
  132. text string within a column using the specified font parameters. Use
  133. **-** to default to the size and font type of :term:`FONT_LABEL`.
  134. **M** *slon*\|\ **-** *slat* *length*\ [**+a**\ *align*][**+f**][**+l**\ [*label*]][**+u**] [**-F**\ *param*] [ **-R**\ *w/e/s/n* **-J**\ *param* ]
  135. Place a map scale in the legend. Specify *slon slat*, the point on
  136. the map where the scale applies (*slon* is only meaningful for
  137. certain oblique projections. If not needed, you must specify **-**
  138. instead). Give *length*, the length of the scale in km (for other units
  139. append **e** (meter), **f** (foot), **M** (mile), **n** (nautical
  140. mile), or **u** (survey foot)). Append **+f** for a fancy map scale
  141. [Default is plain].
  142. Append **+l** to the *length* to select the default label
  143. which equals the distance unit (meter, feet, km, miles, nautical
  144. miles, survey feet) and is justified on top of the scale [t]. Change
  145. this by giving your own label (append **+l**\ *label*). Change label
  146. alignment with **+a**\ *align* (choose among **l**\ (eft),
  147. **r**\ (ight), **t**\ (op) , and **b**\ (ottom)).
  148. Apply **+u** to append the unit to all distance annotations along
  149. the scale. If you want to place a map panel behind the scale,
  150. add a suitable **-F** panel option (see :doc:`basemap` for details
  151. on panels as well as map scale modifiers).
  152. All **+**\ *modifiers* must be appended to *length* to make a single
  153. string argument. If the **-R** **-J** supplied to the module is
  154. different than the projection needed for the scale (or not given at
  155. all, e.g., with **-Dx**), supply the two optional **-R** **-J** settings
  156. as well.
  157. **N** [*ncolumns* or *relwidth1 relwidth2 ... relwidthn*]
  158. Change the number of columns in the legend [1]. This only affects
  159. the printing of symbols (**S**) and labels (**L**). The number of
  160. columns stay in effect until **N** is used again. To get columns
  161. of unequal width, instead provide the relative width of each column
  162. separated by whitespace. The sum of these widths are equated to the
  163. legend width set via **-D**. If no argument is given the we set
  164. *n_columns* to 1.
  165. **P** *paragraph-mode-header-for-pstext*
  166. Start a new text paragraph by specifying all the parameters needed
  167. (see :doc:`text` **-M** record description). Note that the module knows
  168. what all those values should be, so normally you can leave the
  169. entire record (after P) blank or leave it out all together. If you
  170. need to set at least one of the parameters directly, you must
  171. specify all and set the ones you want to leave at their default
  172. value to **-**.
  173. **S** [*dx1 symbol size fill pen* [ *dx2 text* ]]
  174. Plots the selected symbol with specified diameter, fill, and outline
  175. (see :doc:`plot`). The symbol is centered at *dx1* from the left margin
  176. of the column, with the optional explanatory *text* starting *dx2*
  177. from the margin, printed with :term:`FONT_ANNOT_PRIMARY`. If *dx1* is given
  178. as **-** then it is automatically computed from half the largest symbol size.
  179. If *dx2* is given as **-** then it is automatically computed as 1.5
  180. times the largest symbol size. Use **-** if
  181. no *fill* or outline (*pen*) is required. Alternatively, the *fill*
  182. may be specified indirectly via z=\ *value* and the color is assigned
  183. via the CPT look-up (requires a prior **A** code). When plotting just a
  184. symbol, without text, *dx2* and *text* can be omitted. The *dx1* value
  185. can also be given as a justification code **L**\ , **C**\ , or **R** which justifies the
  186. symbol with respect to the current column. If no arguments are given
  187. to **S** then we simply skip to the next column. Three :doc:`plot`
  188. symbols may take special modifiers: front (**f**), quoted line (**q**) and vector (**v**).
  189. You can append modifiers to the symbol and affect how the fronts, quoted lines and
  190. vectors are presented (see :doc:`plot` man page for modifiers).
  191. The module will determine default settings for all modifiers and
  192. secondary arguments if not provided. A few other symbols (the rectangles,
  193. ellipse, wedge, mathangle) may take more than a single argument size.
  194. Note that for a line segment you should use the horizontal dash symbol (**-**).
  195. If just a single size if given then we will provide reasonable
  196. arguments to plot the symbol (See `Defaults`_).
  197. Alternatively, combine the required
  198. arguments into a single, comma-separated string and use that as the
  199. symbol size (again, see :doc:`plot` for details on the arguments needed).
  200. **T** *paragraph-text*
  201. One or more of these **T** records with *paragraph-text* printed
  202. with :term:`FONT_ANNOT_PRIMARY`. To specify special positioning and
  203. typesetting arrangements, or to enter a paragraph break, use the
  204. optional **P** record.
  205. **V** [*offset*] *pen*
  206. The **V** record draws a vertical line between columns (if more than
  207. one) using the selected *pen*. Here, *offset* is analogous to the offset
  208. for the **D** records but in the vertical direction [0]. The first time
  209. **V** is used we remember the vertical position of the last **D** line,
  210. and the second time **V** is set we draw from that past location to the
  211. most recent location of the **D** line. Thus, **D** must be used to
  212. mark the start and stop of a vertical line (so **V** must follow **D**).
  213. If no horizontal line is desired simply give - as *pen* to **D**.
  214. Defaults
  215. --------
  216. When attributes are not provided, or extended symbol information (for symbols taking more than just an overall size) are
  217. not given as comma-separated quantities, we will provide the following defaults:
  218. Front: The *size* argument is *length*\ [/*gap*\ [*ticklength*]]. Front symbol is left-side (here, that means upper side) box,
  219. with *ticklength* set 30% of the given symbol *length (if not specified separately), and *gap* defaulting to -1 (one
  220. entered front symbol) if not specified. Modifiers to the symbol argument can be provided.
  221. Vector: Head size is 30% of given symbol size.
  222. Ellipse: Minor axis is 65% of major axis (the symbol size), with an azimuth of 0 degrees.
  223. Rectangle: Height is 65% of width (the symbol size).
  224. Rotated rectangle: Same, with a rotation of 30 degrees.
  225. Rounded rectangle: Same as rectangle, but with corner radius of 10% of width.
  226. Mathangle: Angles are -10 and 45 degrees, with arrow head size 30% of symbol size.
  227. Wedge: Angles are -30 and 30 degrees.
  228. Note On Legend Height
  229. ---------------------
  230. As **-D** suggests, leaving the *height* off forces a calculation of the
  231. expected height. This is an exact calculation except in the case of
  232. legends that place paragraph text. Here we simply do a first-order
  233. estimate of how many typeset lines might appear. Without access to font
  234. metrics this estimate will occasionally be off by 1 line. If so, note
  235. the reported height (with **-V**) and specify a slightly larger or
  236. smaller height in **-D**.
  237. Windows Remarks
  238. ---------------
  239. Note that under Windows, the percent sign (%) is a variable indicator
  240. (like $ under Unix). To indicate a plain percentage sign in a batch
  241. script you need to repeat it (%%); hence the font switching mechanism
  242. (@%\ *font*\ % and @%%) may require twice the number of percent signs.
  243. This only applies to text inside a script or that otherwise is processed
  244. by DOS. Data files that are opened and read by the module do not need
  245. such duplication.
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...