Skip to content

Commit 1383de3

Browse files
Figure.coast: Improve documentation (#3325)
1 parent 69005cb commit 1383de3

File tree

1 file changed

+51
-78
lines changed

1 file changed

+51
-78
lines changed

pygmt/src/coast.py

+51-78
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,17 @@ def coast(self, **kwargs):
4141
r"""
4242
Plot continents, shorelines, rivers, and borders on maps.
4343
44-
Plots grayshaded, colored, or textured land-masses [or water-masses] on
44+
Plots grayshaded, colored, or textured land masses [or water masses] on
4545
maps and [optionally] draws coastlines, rivers, and political
46-
boundaries. Alternatively, it can (1) issue clip paths that will
47-
contain all land or all water areas, or (2) dump the data to an ASCII
48-
table. The data files come in 5 different resolutions: (**f**)ull,
46+
boundaries. The data files come in 5 different resolutions: (**f**)ull,
4947
(**h**)igh, (**i**)ntermediate, (**l**)ow, and (**c**)rude. The full
5048
resolution files amount to more than 55 Mb of data and provide great
5149
detail; for maps of larger geographical extent it is more economical to
5250
use one of the other resolutions. If the user selects to paint the
53-
land-areas and does not specify fill of water-areas then the latter
51+
land areas and does not specify fill of water areas then the latter
5452
will be transparent (i.e., earlier graphics drawn in those areas will
55-
not be overwritten). Likewise, if the water-areas are painted and no
56-
land fill is set then the land-areas will be transparent.
53+
not be overwritten). Likewise, if the water areas are painted and no
54+
land fill is set then the land areas will be transparent.
5755
5856
A map projection must be supplied.
5957
@@ -71,63 +69,47 @@ def coast(self, **kwargs):
7169
lakes : str or list
7270
*fill*\ [**+l**\|\ **+r**].
7371
Set the shade, color, or pattern for lakes and river-lakes. The
74-
default is the fill chosen for wet areas set by the ``water``
72+
default is the fill chosen for "wet" areas set by the ``water``
7573
parameter. Optionally, specify separate fills by appending
7674
**+l** for lakes or **+r** for river-lakes, and passing multiple
7775
strings in a list.
7876
resolution : str
7977
**f**\|\ **h**\|\ **i**\|\ **l**\|\ **c**.
80-
Select the resolution of the data set to: (**f**\ )ull,
81-
(**h**\ )igh, (**i**\ )ntermediate, (**l**\ )ow,
82-
and (**c**\ )rude.
78+
Select the resolution of the data set to: (**f**\ )ull, (**h**\ )igh,
79+
(**i**\ )ntermediate, (**l**\ )ow, and (**c**\ )rude.
8380
land : str
84-
Select filling or clipping of "dry" areas.
81+
Select filling of "dry" areas.
8582
rivers : int, str, or list
8683
*river*\ [/*pen*].
8784
Draw rivers. Specify the type of rivers and [optionally] append
8885
pen attributes [Default is ``"0.25p,black,solid"``].
8986
90-
Choose from the list of river types below; pass a list to
91-
``rivers`` to use multiple arguments.
92-
93-
0 = Double-lined rivers (river-lakes)
94-
95-
1 = Permanent major rivers
96-
97-
2 = Additional major rivers
98-
99-
3 = Additional rivers
100-
101-
4 = Minor rivers
102-
103-
5 = Intermittent rivers - major
104-
105-
6 = Intermittent rivers - additional
106-
107-
7 = Intermittent rivers - minor
108-
109-
8 = Major canals
110-
111-
9 = Minor canals
112-
113-
10 = Irrigation canals
87+
Choose from the list of river types below; pass a list to ``rivers``
88+
to use multiple arguments.
89+
90+
- ``0``: Double-lined rivers (river-lakes)
91+
- ``1``: Permanent major rivers
92+
- ``2``: Additional major rivers
93+
- ``3``: Additional rivers
94+
- ``4``: Minor rivers
95+
- ``5``: Intermittent rivers - major
96+
- ``6``: Intermittent rivers - additional
97+
- ``7``: Intermittent rivers - minor
98+
- ``8``: Major canals
99+
- ``9``: Minor canals
100+
- ``10``: Irrigation canals
114101
115102
You can also choose from several preconfigured river groups:
116103
117-
a = All rivers and canals (0-10)
118-
119-
A = All rivers and canals except river-lakes (1-10)
120-
121-
r = All permanent rivers (0-4)
104+
- ``"a"``: All rivers and canals (0-10)
105+
- ``"A"``: All rivers and canals except river-lakes (1-10)
106+
- ``"r"``: All permanent rivers (0-4)
107+
- ``"R"``: All permanent rivers except river-lakes (1-4)
108+
- ``"i"``: All intermittent rivers (5-7)
109+
- ``"c"``: All canals (8-10)
122110
123-
R = All permanent rivers except river-lakes (1-4)
124-
125-
i = All intermittent rivers (5-7)
126-
127-
c = All canals (8-10)
128111
map_scale : str
129-
[**g**\|\ **j**\|\ **J**\|\ **n**\|\ **x**]\ *refpoint*\
130-
**+w**\ *length*.
112+
[**g**\|\ **j**\|\ **J**\|\ **n**\|\ **x**]\ *refpoint*\ **+w**\ *length*.
131113
Draw a simple map scale centered on the reference point specified.
132114
box : bool or str
133115
[**+c**\ *clearances*][**+g**\ *fill*][**+i**\ [[*gap*/]\ *pen*]]\
@@ -150,48 +132,39 @@ def coast(self, **kwargs):
150132
borders : int, str, or list
151133
*border*\ [/*pen*].
152134
Draw political boundaries. Specify the type of boundary and
153-
[optionally] append pen attributes
154-
[Default is ``"0.25p,black,solid"``].
155-
156-
Choose from the list of boundaries below. Pass a list to
157-
``borders`` to use multiple arguments.
158-
159-
1 = National boundaries
135+
[optionally] append pen attributes [Default is ``"0.25p,black,solid"``].
160136
161-
2 = State boundaries within the Americas
137+
Choose from the list of boundaries below. Pass a list to ``borders`` to
138+
use multiple arguments.
162139
163-
3 = Marine boundaries
140+
- ``1``: National boundaries
141+
- ``2``: State boundaries within the Americas
142+
- ``3``: Marine boundaries
143+
- ``"a"``: All boundaries (1-3)
164144
165-
a = All boundaries (1-3)
166145
water : str
167-
Select filling or clipping of "wet" areas.
146+
Select filling "wet" areas.
168147
shorelines : int, str, or list
169148
[*level*\ /]\ *pen*.
170149
Draw shorelines [Default is no shorelines]. Append pen attributes
171-
[Default is ``"0.25p,black,solid"``] which
172-
apply to all four levels. To set the pen for a single level,
173-
pass a string with *level*\ /*pen*\ , where level is
174-
1-4 and represent coastline, lakeshore, island-in-lake shore, and
175-
lake-in-island-in-lake shore. Pass a list of *level*\ /*pen*
150+
[Default is ``"0.25p,black,solid"``] which apply to all four levels.
151+
To set the pen for a single level, pass a string with *level*\ /*pen*\ ,
152+
where level is 1-4 and represent coastline, lakeshore, island-in-lake shore,
153+
and lake-in-island-in-lake shore. Pass a list of *level*\ /*pen*
176154
strings to ``shorelines`` to set multiple levels. When specific
177155
level pens are set, those not listed will not be drawn.
178156
dcw : str or list
179-
*code1,code2,…*\ [**+l**\|\ **L**\ ][**+g**\ *fill*\ ]
180-
[**+p**\ *pen*\ ][**+z**].
181-
Select painting or dumping country polygons from the
182-
`Digital Chart of the World
157+
*code1,code2,…*\ [**+g**\ *fill*\ ][**+p**\ *pen*\ ][**+z**].
158+
Select painting country polygons from the `Digital Chart of the World
183159
<https://en.wikipedia.org/wiki/Digital_Chart_of_the_World>`__.
184160
Append one or more comma-separated countries using the 2-character
185161
`ISO 3166-1 alpha-2 convention
186162
<https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2>`__.
187-
To select a state of a country (if available), append
188-
.\ *state*, (e.g, US.TX for Texas). To specify a whole continent,
189-
prepend **=** to any of the continent codes (e.g. =EU for Europe).
190-
Append **+p**\ *pen* to draw polygon outlines
191-
[Default is no outline] and **+g**\ *fill* to fill them
192-
[Default is no fill]. Append **+l**\|\ **+L** to =\ *continent* to
193-
only list countries in that continent; repeat if more than one
194-
continent is requested.
163+
To select a state of a country (if available), append .\ *state*,
164+
(e.g, ``"US.TX"`` for Texas). To specify a whole continent, prepend **=**
165+
to any of the continent codes (e.g. ``"=EU"`` for Europe). Append
166+
**+p**\ *pen* to draw polygon outlines [Default is no outline] and
167+
**+g**\ *fill* to fill them [Default is no fill].
195168
{panel}
196169
{perspective}
197170
{transparency}
@@ -204,11 +177,11 @@ def coast(self, **kwargs):
204177
>>> fig = pygmt.Figure()
205178
>>> # Call the coast method for the plot
206179
>>> fig.coast(
207-
... # Set the projection to Mercator, and plot size to 10 cm
180+
... # Set the projection to Mercator, and the plot width to 10 centimeters
208181
... projection="M10c",
209182
... # Set the region of the plot
210183
... region=[-10, 30, 30, 60],
211-
... # Set the frame of the plot
184+
... # Set the frame of the plot, here annotations and major ticks
212185
... frame="a",
213186
... # Set the color of the land to "darkgreen"
214187
... land="darkgreen",

0 commit comments

Comments
 (0)