Skip to content

Commit

Permalink
Merge branch 'master' into grdimage/document_all_args
Browse files Browse the repository at this point in the history
  • Loading branch information
weiji14 committed Sep 21, 2020
2 parents a0771e6 + 56ba083 commit 8ad8d7c
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 16 deletions.
54 changes: 38 additions & 16 deletions pygmt/base_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ def _preprocess(self, **kwargs): # pylint: disable=no-self-use
U="timestamp",
X="xshift",
Y="yshift",
p="perspective",
t="transparency",
)
@kwargs_to_strings(R="sequence")
@kwargs_to_strings(R="sequence", p="sequence")
def coast(self, **kwargs):
"""
Plot continents, shorelines, rivers, and borders on maps
Expand Down Expand Up @@ -132,6 +133,7 @@ def coast(self, **kwargs):
``'[level/]pen'``
Draw shorelines [Default is no shorelines]. Append pen attributes.
{XY}
{p}
{t}
"""
Expand All @@ -151,9 +153,10 @@ def coast(self, **kwargs):
W="scale",
X="xshift",
Y="yshift",
p="perspective",
t="transparency",
)
@kwargs_to_strings(R="sequence", G="sequence")
@kwargs_to_strings(R="sequence", G="sequence", p="sequence")
def colorbar(self, **kwargs):
"""
Plot a gray or color scale-bar on maps.
Expand Down Expand Up @@ -214,6 +217,7 @@ def colorbar(self, **kwargs):
Multiply all z-values in the CPT by the provided scale. By default
the CPT is used as is.
{XY}
{p}
{t}
"""
Expand All @@ -237,9 +241,10 @@ def colorbar(self, **kwargs):
l="label",
X="xshift",
Y="yshift",
p="perspective",
t="transparency",
)
@kwargs_to_strings(R="sequence", L="sequence", A="sequence_plus")
@kwargs_to_strings(R="sequence", L="sequence", A="sequence_plus", p="sequence")
def grdcontour(self, grid, **kwargs):
"""
Convert grids or images to contours and plot them on maps
Expand Down Expand Up @@ -295,6 +300,7 @@ def grdcontour(self, grid, **kwargs):
to be of the format [*annotcontlabel*][/*contlabel*]. If either
label contains a slash (/) character then use ``|`` as the
separator for the two labels instead.
{p}
{t}
"""
kwargs = self._preprocess(**kwargs)
Expand Down Expand Up @@ -329,10 +335,11 @@ def grdcontour(self, grid, **kwargs):
X="xshift",
Y="yshift",
n="interpolation",
p="perspective",
t="transparency",
x="cores",
)
@kwargs_to_strings(R="sequence")
@kwargs_to_strings(R="sequence", p="sequence")
def grdimage(self, grid, **kwargs):
"""
Project and plot grids or images.
Expand Down Expand Up @@ -448,6 +455,7 @@ def grdimage(self, grid, **kwargs):
{V}
{XY}
{n}
{p}
{t}
{x}
Expand Down Expand Up @@ -479,10 +487,10 @@ def grdimage(self, grid, **kwargs):
Wc="contourpen",
Wm="meshpen",
Wf="facadepen",
p="perspective",
I="shading",
X="xshift",
Y="yshift",
p="perspective",
t="transparency",
)
@kwargs_to_strings(R="sequence", p="sequence")
Expand Down Expand Up @@ -547,10 +555,6 @@ def grdview(self, grid, **kwargs):
Sets the pen attributes used for the facade. You must also select
-N for the facade outline to be drawn.
perspective : list or str
``'[x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]'``.
Select perspective view.
shading : str
Provide the name of a grid file with intensities in the (-1,+1)
range, or a constant intensity to apply everywhere (affects the
Expand All @@ -561,6 +565,7 @@ def grdview(self, grid, **kwargs):
``+d`` to select the default arguments (``+a-45+nt1+m0``).
{XY}
{p}
{t}
"""
Expand Down Expand Up @@ -604,9 +609,10 @@ def grdview(self, grid, **kwargs):
U="timestamp",
X="xshift",
Y="yshift",
p="perspective",
t="transparency",
)
@kwargs_to_strings(R="sequence", i="sequence_comma")
@kwargs_to_strings(R="sequence", i="sequence_comma", p="sequence")
def plot(self, x=None, y=None, data=None, sizes=None, direction=None, **kwargs):
"""
Plot lines, polygons, and symbols on maps.
Expand Down Expand Up @@ -676,6 +682,7 @@ def plot(self, x=None, y=None, data=None, sizes=None, direction=None, **kwargs):
label : str
Add a legend entry for the symbol or line being plotted.
{p}
{t}
"""
kwargs = self._preprocess(**kwargs)
Expand Down Expand Up @@ -728,9 +735,10 @@ def plot(self, x=None, y=None, data=None, sizes=None, direction=None, **kwargs):
C="levels",
X="xshift",
Y="yshift",
p="perspective",
t="transparency",
)
@kwargs_to_strings(R="sequence", i="sequence_comma")
@kwargs_to_strings(R="sequence", i="sequence_comma", p="sequence")
def contour(self, x=None, y=None, z=None, data=None, **kwargs):
"""
Contour table data by direct triangulation.
Expand Down Expand Up @@ -787,6 +795,7 @@ def contour(self, x=None, y=None, z=None, data=None, **kwargs):
label contains a slash (/) character then use ``|`` as the
separator for the two labels instead.
{XY}
{p}
{t}
"""
Expand Down Expand Up @@ -820,9 +829,10 @@ def contour(self, x=None, y=None, z=None, data=None, **kwargs):
U="timestamp",
X="xshift",
Y="yshift",
p="perspective",
t="transparency",
)
@kwargs_to_strings(R="sequence")
@kwargs_to_strings(R="sequence", p="sequence")
def basemap(self, **kwargs):
"""
Produce a basemap for the figure.
Expand Down Expand Up @@ -855,6 +865,7 @@ def basemap(self, **kwargs):
reference and anchor points
{U}
{XY}
{p}
{t}
"""
Expand All @@ -873,9 +884,10 @@ def basemap(self, **kwargs):
F="box",
X="xshift",
Y="yshift",
p="perspective",
t="transparency",
)
@kwargs_to_strings(R="sequence")
@kwargs_to_strings(R="sequence", p="sequence")
def logo(self, **kwargs):
"""
Place the GMT graphics logo on a map.
Expand All @@ -901,6 +913,7 @@ def logo(self, **kwargs):
GMT logo.
{U}
{XY}
{p}
{t}
"""
Expand All @@ -919,9 +932,10 @@ def logo(self, **kwargs):
M="monochrome",
X="xshift",
Y="yshift",
p="perspective",
t="transparency",
)
@kwargs_to_strings(R="sequence")
@kwargs_to_strings(R="sequence", p="sequence")
def image(self, imagefile, **kwargs):
"""
Place images or EPS files on maps.
Expand Down Expand Up @@ -955,6 +969,7 @@ def image(self, imagefile, **kwargs):
Convert color image to monochrome grayshades using the (television)
YIQ-transformation.
{XY}
{p}
{t}
"""
kwargs = self._preprocess(**kwargs)
Expand All @@ -970,9 +985,10 @@ def image(self, imagefile, **kwargs):
F="box",
X="xshift",
Y="yshift",
p="perspective",
t="transparency",
)
@kwargs_to_strings(R="sequence")
@kwargs_to_strings(R="sequence", p="sequence")
def legend(self, spec=None, position="JTR+jTR+o0.2c", box="+gwhite+p1p", **kwargs):
"""
Plot legends on maps.
Expand Down Expand Up @@ -1007,6 +1023,7 @@ def legend(self, spec=None, position="JTR+jTR+o0.2c", box="+gwhite+p1p", **kwarg
default, uses '+gwhite+p1p' which draws a box around the legend
using a 1 point black pen and adds a white background.
{XY}
{p}
{t}
"""
kwargs = self._preprocess(**kwargs)
Expand Down Expand Up @@ -1038,6 +1055,7 @@ def legend(self, spec=None, position="JTR+jTR+o0.2c", box="+gwhite+p1p", **kwarg
W="pen",
X="xshift",
Y="yshift",
p="perspective",
t="transparency",
)
@kwargs_to_strings(
Expand All @@ -1046,6 +1064,7 @@ def legend(self, spec=None, position="JTR+jTR+o0.2c", box="+gwhite+p1p", **kwarg
angle="sequence_comma",
font="sequence_comma",
justify="sequence_comma",
p="sequence",
)
def text(
self,
Expand Down Expand Up @@ -1145,6 +1164,7 @@ def text(
(see *clearance*) [Default is width = default, color = black,
style = solid].
{XY}
{p}
{t}
"""
kwargs = self._preprocess(**kwargs)
Expand Down Expand Up @@ -1202,9 +1222,10 @@ def text(
C="offset",
X="xshift",
Y="yshift",
p="perspective",
t="transparency",
)
@kwargs_to_strings(R="sequence")
@kwargs_to_strings(R="sequence", p="sequence")
def meca(
self,
spec,
Expand Down Expand Up @@ -1300,6 +1321,7 @@ def meca(
{R}
{B}
{XY}
{p}
{t}
"""

Expand Down
7 changes: 7 additions & 0 deletions pygmt/helpers/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@
- 'c' for bicubic [Default]
- 'l' for bilinear
- 'n' for nearest-neighbor""",
"p": """\
perspective : list or str
``'[x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]'``.
Select perspective view and set the azimuth and elevation angle of
the viewpoint. Default is [180, 90]. Full documentation is at
:gmt-docs:`gmt.html#perspective-full`.
""",
"registration": """\
registration : str
``[g|p]``
Expand Down

0 comments on commit 8ad8d7c

Please sign in to comment.