Skip to content

Update the docstrings in the plotting modules #881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 59 commits into from
Feb 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
00e5495
Update basemap docstrings
Feb 12, 2021
1d14d58
Update docstrings with GMT formatting
Feb 13, 2021
9df08fa
Merge branch 'master' into docstrings-format-update
Feb 13, 2021
ab5710b
Update line lengths
Feb 13, 2021
cdcedae
Make raw strings
Feb 13, 2021
e8031c2
Update docstrings
Feb 13, 2021
889c32d
Update pygmt/src/basemap.py
Feb 13, 2021
0ebad8a
Update pygmt/src/colorbar.py
Feb 13, 2021
bb1cb07
Update pygmt/src/colorbar.py
Feb 13, 2021
5b966f6
Update pygmt/src/colorbar.py
Feb 13, 2021
c5b22a7
Update pygmt/src/colorbar.py
Feb 13, 2021
2eeaff8
Update docstrings
Feb 13, 2021
70ab3f8
Update docstrings colorbar and text
Feb 13, 2021
100f69d
Update colorbar docstrings
Feb 13, 2021
b118e1b
Update contour docstring
Feb 13, 2021
b20df38
Update grdview docstring
Feb 13, 2021
9d31a91
Update basemap docstring
Feb 13, 2021
79d780d
Update coast docstring
Feb 13, 2021
2d35585
Update colorbar docstring
Feb 13, 2021
df2bccd
Change width argument to length
Feb 13, 2021
8fcecb4
Update contour docstring
Feb 13, 2021
05dad1f
Update grdcontour docstring
Feb 13, 2021
c10a520
Update grdimage docstring
Feb 13, 2021
ecddad9
Update inset docstring
Feb 13, 2021
2b135ca
Update legend docstring
Feb 13, 2021
a1af441
Update plot docstring
Feb 13, 2021
5067b34
Update plot3d docstring
Feb 13, 2021
d6509ab
Update text docstring
Feb 13, 2021
8052f6d
Update pygmt/src/basemap.py
Feb 14, 2021
09ec237
Update pygmt/src/coast.py
Feb 14, 2021
a77968a
Update pygmt/src/coast.py
Feb 14, 2021
35462ba
Update pygmt/src/plot3d.py
Feb 14, 2021
98d7d4c
Update pygmt/src/coast.py
Feb 14, 2021
6245ace
Update pygmt/src/plot3d.py
Feb 14, 2021
f7d9aee
Update pygmt/src/text.py
Feb 14, 2021
3806b65
Update pygmt/src/plot3d.py
Feb 14, 2021
52d6423
Update pygmt/src/text.py
Feb 14, 2021
2dffff3
Update pygmt/src/colorbar.py
Feb 14, 2021
3b5470c
Update pygmt/src/colorbar.py
Feb 14, 2021
f91268b
Update pygmt/src/contour.py
Feb 14, 2021
d43dd17
Update pygmt/src/image.py
Feb 14, 2021
46d1df9
Update pygmt/src/image.py
Feb 14, 2021
aade1f4
Update pygmt/src/image.py
Feb 14, 2021
b268ff2
Update pygmt/src/legend.py
Feb 14, 2021
53ac350
Update pygmt/src/logo.py
Feb 14, 2021
259f7e4
Update pygmt/src/legend.py
Feb 14, 2021
baa26ec
Apply suggestions from code review
Feb 14, 2021
760f17b
Apply suggestions from code review
Feb 14, 2021
fa60245
Format docstrings
Feb 14, 2021
56470cf
Update line breaks between docstring arguments
Feb 14, 2021
1a030b9
Update args/params/options descriptions
Feb 14, 2021
bc87fed
Update symbol parameters description
Feb 14, 2021
f4147ba
Merge branch 'master' into docstrings-format-update
Feb 14, 2021
6fd4e9e
Apply suggestions from code review
Feb 14, 2021
21f3a61
Apply suggestions from code review
Feb 14, 2021
677f780
Merge branch 'master' into docstrings-format-update
Feb 14, 2021
2c93de1
Update pygmt/src/grdimage.py
Feb 14, 2021
f76bade
Update inset.py
Feb 14, 2021
be030f3
Update decorators.py
Feb 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pygmt/helpers/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
- **n** for nearest-neighbor""",
"p": r"""
perspective : list or str
[**x**\|\ **y**\|\ **z**]\ *azim*\[/*elev*\[/*zlevel*]]
[**x**\|\ **y**\|\ **z**]\ *azim*\[/*elev*\[/*zlevel*]]\
[**+w**\ *lon0*/*lat0*\[/*z0*]][**+v**\ *x0*/*y0*].
Select perspective view and set the azimuth and elevation angle of
the viewpoint. Default is [180, 90]. Full documentation is at
Expand Down
9 changes: 5 additions & 4 deletions pygmt/src/basemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@
)
@kwargs_to_strings(R="sequence", c="sequence_comma", p="sequence")
def basemap(self, **kwargs):
"""
r"""
Plot base maps and frames for the figure.

Creates a basic or fancy basemap with axes, fill, and titles. Several
map projections are available, and the user may specify separate
tick-mark intervals for boundary annotation, ticking, and [optionally]
gridlines. A simple map scale or directional rose may also be plotted.

At least one of the options *frame*, *map_scale*, *rose* or *compass*
must be specified.
At least one of the parameters ``frame``, ``map_scale``, ``rose`` or
``compass`` must be specified.

Full option list at :gmt-docs:`basemap.html`

Expand All @@ -56,7 +56,8 @@ def basemap(self, **kwargs):
{R}
{B}
map_scale : str
``'[g|j|J|n|x]refpoint'``
[**g**\|\ **j**\|\ **J**\|\ **n**\|\ **x**]\ *refpoint*\
**+w**\ *length*.
Draws a simple map scale centered on the reference point specified.
rose : str
Draws a map directional rose on the map at the location defined by
Expand Down
26 changes: 12 additions & 14 deletions pygmt/src/coast.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,11 @@ def coast(self, **kwargs):
{J}
{R}
area_thresh : int, float, or str
*min_area*\ [/*min_level*/*max_level*][**+ag**\|\ **i**\
\|\ **s**\|\ **S**][**+r**\|\ **l**][**+p**\
*percent*].
Features with an area smaller than min_area in km^2 or of
hierarchical level that is lower than min_level or higher than
max_level will not be plotted.
*min_area*\ [/*min_level*/*max_level*][**+a**\[**g**\|\ **i**]\
[**s**\|\ **S**][**+l**\|\ **r**][**+p**\ *percent*].
Features with an area smaller than *min_area* in km\ :sup:`2` or of
hierarchical level that is lower than *min_level* or higher than
*max_level* will not be plotted.
{B}
lakes : str or list
*fill*\ [**+l**\|\ **+r**].
Expand All @@ -90,7 +89,7 @@ def coast(self, **kwargs):
rivers : int or str or list
*river*\ [/*pen*].
Draw rivers. Specify the type of rivers and [optionally] append
pen attributes [Default pen: width = default, color = black,
pen attributes [Default pen is width = default, color = black,
style = solid].

Choose from the list of river types below; pass a list to
Expand Down Expand Up @@ -132,12 +131,13 @@ def coast(self, **kwargs):

c = All canals (8-10)
map_scale : str
[**g**\|\ **j**\|\ **J**\|\ **n**\|\ **x**]\ *refpoint*.
[**g**\|\ **j**\|\ **J**\|\ **n**\|\ **x**]\ *refpoint*\
**+w**\ *length*.
Draws a simple map scale centered on the reference point specified.
borders : int or str or list
*border*\ [/*pen*].
Draw political boundaries. Specify the type of boundary and
[optionally] append pen attributes [Default pen: width = default,
[optionally] append pen attributes [Default pen is width = default,
color = black, style = solid].

Choose from the list of boundaries below. Pass a list to
Expand All @@ -156,7 +156,7 @@ def coast(self, **kwargs):
shorelines : int or str or list
[*level*\ /]\ *pen*.
Draw shorelines [Default is no shorelines]. Append pen attributes
[Defaults: width = default, color = black, style = solid] which
[Default is width = default, color = black, style = solid] which
apply to all four levels. To set the pen for a single level,
pass a string with *level*\ /*pen*\ , where level is
1-4 and represent coastline, lakeshore, island-in-lake shore, and
Expand All @@ -177,11 +177,9 @@ def coast(self, **kwargs):
prepend **=** to any of the continent codes (e.g. =EU for Europe).
Append **+p**\ *pen* to draw polygon outlines
(default is no outline) and **+g**\ *fill* to fill them
(default is no fill). Append **+l**\|\ **+L** to *=continent* to
(default is no fill). Append **+l**\|\ **+L** to =\ *continent* to
only list countries in that continent; repeat if more than one
continent is requested. Append **+z** to place the country code in
the segment headers via **-Z**\ *code* settings.To apply different
settings to different countries, pass a list of string arguments.
continent is requested.
{XY}
{c}
{p}
Expand Down
80 changes: 42 additions & 38 deletions pygmt/src/colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@
R="sequence", G="sequence", I="sequence", c="sequence_comma", p="sequence"
)
def colorbar(self, **kwargs):
"""
r"""
Plot a gray or color scale-bar on maps.

Both horizontal and vertical scales are supported. For CPTs with
gradational colors (i.e., the lower and upper boundary of an interval
have different colors) we will interpolate to give a continuous scale.
Variations in intensity due to shading/illumination may be displayed by
setting the option -I. Colors may be spaced according to a linear
scale, all be equal size, or by providing a file with individual tile
widths.
setting the ``shading`` parameter. Colors may be spaced according to a
linear scale, all be equal size, or by providing a file with individual
tile widths.

Full option list at :gmt-docs:`colorbar.html`

Expand All @@ -49,52 +49,56 @@ def colorbar(self, **kwargs):
Set color bar boundary frame, labels, and axes attributes.
{CPT}
position : str
``[g|j|J|n|x]refpoint[+wlength[/width]][+e[b|f][length]][+h|v]
[+jjustify][+m[a|c|l|u]][+n[txt]][+odx[/dy]]``. Defines the
reference point on the map for the color scale using one of four
coordinate systems: (1) Use *g* for map (user) coordinates, (2) use
*j* or *J* for setting refpoint via a 2-char justification code
that refers to the (invisible) map domain rectangle, (3) use *n*
for normalized (0-1) coordinates, or (4) use *x* for plot
coordinates (inches, cm, etc.). All but *x* requires both *region*
and *projection* to be specified. Append +w followed by the length
and width of the color bar. If width is not specified then it is
[**g**\|\ **j**\|\ **J**\|\ **n**\|\ **x**]\ *refpoint*\
[**+w**\ *length*\ [/\ *width*]]\ [**+e**\ [**b**\|\ **f**][*length*]]\
[**+h**\|\ **v**][**+j**\ *justify*]\
[**+m**\ [**a**\|\ **c**\|\ **l**\|\ **u**]]\
[**+n**\ [*txt*]][**+o**\ *dx*\ [/*dy*]].
Defines the reference point on the map for the color scale using one of
four coordinate systems: (1) Use **g** for map (user) coordinates, (2)
use **j** or **J** for setting *refpoint* via a 2-char justification
code that refers to the (invisible) map domain rectangle, (3) use **n**
for normalized (0-1) coordinates, or (4) use **x** for plot
coordinates (inches, cm, etc.). All but **x** requires both ``region``
and ``projection`` to be specified. Append **+w** followed by the
length and width of the color bar. If width is not specified then it is
set to 4% of the given length. Give a negative length to reverse
the scale bar. Append +h to get a horizontal scale
[Default is vertical (+v)]. By default, the anchor point on the
scale is assumed to be the bottom left corner (BL), but this can be
changed by appending +j followed by a 2-char justification code
the scale bar. Append **+h** to get a horizontal scale
[Default is vertical (**+v**)]. By default, the anchor point on the
scale is assumed to be the bottom left corner (**BL**), but this can be
changed by appending **+j** followed by a 2-char justification code
*justify*.
box : bool or str
``[+cclearances][+gfill][+i[[gap/]pen]][+p[pen]][+r[radius]]
[+s[[dx/dy/][shade]]]``. If set to True, draws a rectangular
border around the color scale. Alternatively, specify a different
pen with +ppen. Add +gfill to fill the scale panel [no fill].
Append +cclearance where clearance is either gap, xgap/ygap, or
lgap/rgap/bgap/tgap where these items are uniform, separate in x-
and y-direction, or individual side spacings between scale and
border. Append +i to draw a secondary, inner border as well. We use
a uniform gap between borders of 2p and the MAP_DEFAULTS_PEN unless
other values are specified. Append +r to draw rounded rectangular
borders instead, with a 6p corner radius. You can override this
radius by appending another value. Finally, append +s to draw an
offset background shaded region. Here, dx/dy indicates the shift
[**+c**\ *clearances*][**+g**\ *fill*][**+i**\ [[*gap*/]\ *pen*]]\
[**+p**\ [*pen*]][**+r**\ [*radius*]][**+s**\ [[*dx*/*dy*/][*shade*]]].
If set to ``True``, draws a rectangular border around the color scale.
Alternatively, specify a different pen with **+p**\ *pen*. Add
**+g**\ *fill* to fill the scale panel [default is no fill]. Append
**+c**\ *clearance* where *clearance* is either gap, xgap/ygap, or
lgap/rgap/bgap/tgap where these items are uniform, separate in x- and
y-direction, or individual side spacings between scale and border.
Append **+i** to draw a secondary, inner border as well. We use a
uniform gap between borders of 2p and the :gmt-term:`MAP_DEFAULTS_PEN`
unless other values are specified. Append **+r** to draw rounded
rectangular borders instead, with a 6p corner radius. You can override
this radius by appending another value. Finally, append **+s** to draw
an offset background shaded region. Here, *dx/dy* indicates the shift
relative to the foreground frame [4p/-4p] and shade sets the fill
style to use for shading [gray50].
style to use for shading [default is gray50].
truncate : list or str
``zlo/zhi`` Truncate the incoming CPT so that the lowest and
highest z-levels are to zlo and zhi. If one of these equal NaN then
we leave that end of the CPT alone. The truncation takes place
before the plotting.
*zlo*/*zhi*.
Truncate the incoming CPT so that the lowest and highest z-levels are
to *zlo* and *zhi*. If one of these equal NaN then we leave that end of
the CPT alone. The truncation takes place before the plotting.
scale : float
Multiply all z-values in the CPT by the provided scale. By default
the CPT is used as is.
shading : str or list or bool
Add illumination effects. Passing a single numerical value sets the
range of intensities from -value to +value. If not specified, 1 is
used. Alternatively, set ``shading=[low, high]`` to specify an
asymmetric intensity range from *low* to *high*. The default is no
illumination.
asymmetric intensity range from *low* to *high*. [Default is no
illumination].
{V}
{XY}
{c}
Expand Down
17 changes: 9 additions & 8 deletions pygmt/src/contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def contour(self, x=None, y=None, z=None, data=None, **kwargs):
Takes a matrix, (x,y,z) pairs, or a file name as input and plots lines,
polygons, or symbols at those locations on a map.

Must provide either *data* or *x*, *y*, and *z*.
Must provide either ``data`` or ``x``/``y``/``z``.

Full option list at :gmt-docs:`contour.html`

Expand All @@ -67,23 +67,24 @@ def contour(self, x=None, y=None, z=None, data=None, **kwargs):
levels : str
Contour file or level(s)
D : str
Dump contour coordinates
Dump contour coordinates.
E : str
Network information
Network information.
label_placement : str
Placement of labels
Placement of labels.
I : bool
Color the triangles using CPT
Color the triangles using CPT.
triangular_mesh_pen : str
Pen to draw the underlying triangulation (default none)
Pen to draw the underlying triangulation [Default is none].
no_clip : bool
Do NOT clip contours or image at the boundaries [Default will clip
to fit inside region].
Q : float or str
[*cut*][**+z**].
Do not draw contours with less than cut number of points.
``'[cut[unit]][+z]'``
skip : bool or str
Skip input points outside region ``'[p|t]'``
[**p**\|\ **t**].
Skip input points outside region.
{W}
label : str
Add a legend entry for the contour being plotted. Normally, the
Expand Down
25 changes: 13 additions & 12 deletions pygmt/src/grdcontour.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
R="sequence", L="sequence", A="sequence_plus", c="sequence_comma", p="sequence"
)
def grdcontour(self, grid, **kwargs):
"""
r"""
Convert grids or images to contours and plot them on maps.

Takes a grid file name or an xarray.DataArray object as input.
Expand All @@ -57,23 +57,23 @@ def grdcontour(self, grid, **kwargs):
- The filename of a `CPT` file where the color boundaries will
be used as contour levels.
- The filename of a 2 (or 3) column file containing the contour
levels (col 1), (C)ontour or (A)nnotate (col 2), and optional
levels (col 1), (**C**)ontour or (**A**)nnotate (col 2), and optional
angle (col 3)
- A fixed contour interval ``cont_int`` or a single contour with
``+[cont_int]``
- A fixed contour interval *cont_int* or a single contour with
+\ *cont_int*
annotation : str, int, or list
Specify or disable annotated contour levels, modifies annotated
contours specified in ``-C``.
contours specified in ``interval``.

- Specify a fixed annotation interval ``annot_int`` or a
single annotation level ``+[annot_int]``
- Disable all annotation with ``'-'``
- Specify a fixed annotation interval *annot_int* or a
single annotation level +\ *annot_int*
- Disable all annotation with **-**
- Optional label modifiers can be specified as a single string
``'[annot_int]+e'`` or with a list of options
``'[annot_int]+e'`` or with a list of arguments
``([annot_int], 'e', 'f10p', 'gred')``.
limit : str or list of 2 ints
*low*/*high*.
Do no draw contours below `low` or above `high`, specify as string
``'[low]/[high]'`` or list ``[low,high]``.
cut : str or int
Do not draw contours with less than `cut` number of points.
resample : str or int
Expand All @@ -82,8 +82,9 @@ def grdcontour(self, grid, **kwargs):
{R}
{B}
label_placement : str
``[d|f|n|l|L|x|X]params``.
The required argument controls the placement of labels along the
[**d**\|\ **f**\|\ **n**\|\ **l**\|\ **L**\|\ **x**\|\ **X**]\
*args*.
The required parameter controls the placement of labels along the
quoted lines. It supports five controlling algorithms. See
:gmt-docs:`grdcontour.html#g` for details.
{U}
Expand Down
Loading