Skip to content

Commit

Permalink
Replace argument with parameter in gallery examples and tutorials (#943)
Browse files Browse the repository at this point in the history
Co-authored-by: Meghan Jones <[email protected]>
  • Loading branch information
willschlitzer and maxrjones authored Feb 22, 2021
1 parent c93517a commit 34b30aa
Show file tree
Hide file tree
Showing 24 changed files with 82 additions and 78 deletions.
10 changes: 5 additions & 5 deletions examples/gallery/coast/borders.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
Political Boundaries
--------------------
The ``borders`` argument of :meth:`pygmt.Figure.coast` specifies levels of political
The ``borders`` parameter of :meth:`pygmt.Figure.coast` specifies levels of political
boundaries to plot and the pen used to draw them. Choose from the list of boundaries
below:
* 1 = National boundaries
* 2 = State boundaries within the Americas
* 3 = Marine boundaries
* a = All boundaries (1-3)
* **1** = National boundaries
* **2** = State boundaries within the Americas
* **3** = Marine boundaries
* **a** = All boundaries (1-3)
For example, to draw national boundaries with 1p thickness black lines use
``borders="1/1p,black"``. You can draw multiple boundaries by passing in a list to
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/coast/land_and_water.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Color land and water
--------------------
The ``land`` and ``water`` arguments of :meth:`pygmt.Figure.coast` specify a color to
The ``land`` and ``water`` parameters of :meth:`pygmt.Figure.coast` specify a color to
fill in the land and water masses, respectively. You can use standard GMT color names or
give a hex value (like ``#333333``).
"""
Expand Down
9 changes: 5 additions & 4 deletions examples/gallery/grid/grdview_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
The :meth:`pygmt.Figure.grdview()` method can plot 3-D surfaces with ``surftype="s"``. Here,
we supply the data as an :class:`xarray.DataArray` with the coordinate vectors ``x`` and
``y`` defined. Note that the ``perspective`` argument here controls the azimuth and
elevation angle of the view. We provide a list of two arguments to ``frame`` — the
``y`` defined. Note that the ``perspective`` parameter here controls the azimuth and
elevation angle of the view. We provide a list of two arguments to ``frame`` - the
first argument specifies the :math:`x`- and :math:`y`:-axes frame attributes and the
second argument, prepended with ``"z"``, specifies the :math:`z`-axis frame attributes.
Specifying the same scale for the ``projection`` and ``zcale`` arguments ensures equal
axis scaling. The ``shading`` argument specifies illumination; here we choose an azimuth of
Specifying the same scale for the ``projection`` and ``zcale`` parameters ensures equal
axis scaling. The ``shading`` parameter specifies illumination; here we choose an azimuth of
45° with ``shading="+a45"``.
"""

Expand Down
14 changes: 7 additions & 7 deletions examples/gallery/grid/track_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
The :func:`pygmt.grdtrack` function samples a raster grid's value along specified
points. We will need to input a 2D raster to ``grid`` which can be an
:class:`xarray.DataArray`. The ``points`` argument can be a :class:`pandas.DataFrame` table where
the first two columns are x and y (or longitude and latitude). Note also that there is a
``newcolname`` argument that will be used to name the new column of values we sampled
from the grid.
:class:`xarray.DataArray`. The argument passed to the ``points`` parameter can be a
:class:`pandas.DataFrame` table where the first two columns are x and y (or longitude
and latitude). Note also that there is a ``newcolname`` parameter that will be used to
name the new column of values sampled from the grid.
Alternatively, we can provide a NetCDF file path to ``grid``. An ASCII file path can
also be accepted for ``points``, but an ``outfile`` argument will then need to be set
to name the resulting output ASCII file.
Alternatively, a NetCDF file path can be passed to ``grid``. An ASCII file path can
also be accepted for ``points``. To save an output ASCII file, a file name argument
needs to be passed to the ``outfile`` parameter.
"""

import pygmt
Expand Down
9 changes: 5 additions & 4 deletions examples/gallery/line/line-custom-cpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
-----------------------------
The color of the lines made by :meth:`pygmt.Figure.plot` can be set according to a
custom CPT and assigned with the ``pen`` argument.
custom CPT and assigned with the ``pen`` parameter.
The custom CPT can be used by setting the plot command's ``cmap`` argument to ``True``. The
``zvalue`` argument sets the z-value (color) to be used from the custom CPT, and the line
color is set as the z-value by using **+z** when setting the ``pen`` color.
The custom CPT can be used by setting the plot command's ``cmap`` parameter to
``True``. The ``zvalue`` parameter sets the z-value (color) to be used from the custom
CPT, and the line color is set as the z-value by using **+z** when setting the ``pen``
color.
"""

Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/line/linestyles.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
The :meth:`pygmt.Figure.plot` method can plot lines in different styles.
The default line style is a 0.25-point wide, black, solid line, and can be
customized via the ``pen`` argument.
customized with the ``pen`` parameter.
A *pen* in GMT has three attributes: *width*, *color*, and *style*.
The *style* attribute controls the appearance of the line.
Expand Down
9 changes: 5 additions & 4 deletions examples/gallery/plot/colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
--------
The :meth:`pygmt.Figure.colorbar` method creates a color scalebar. We must
specify the colormap via the ``cmap`` argument, and optionally set the
placement via the ``position`` argument. The full list of color palette tables
specify the colormap via the ``cmap`` parameter, and optionally set the
placement via the ``position`` parameter. The full list of color palette tables
can be found at :gmt-docs:`cookbook/cpts.html`. You can set the ``position`` of
the colorbar using the following options:
Expand All @@ -18,7 +18,7 @@
point.
- **n**: using normalized (0-1) coordinates, e.g. ``position="n0.4/0.8"``.
Note that the anchor point defaults to the bottom left (BL). Append ``+h`` to
Note that the anchor point defaults to the bottom left (**BL**). Append ``+h`` to
``position`` to get a horizontal colorbar instead of a vertical one.
"""
import pygmt
Expand Down Expand Up @@ -49,7 +49,8 @@
# with a length/width (+w) of 7cm by 0.5cm and a box for NaN values (+n)
position="JMR+o1c/0c+w7c/0.5c+n+mc",
# Note that the label 'Elevation' is moved to the opposite side and plotted
# vertically as a column of text using '+mc' in the position argument above
# vertically as a column of text using '+mc' in the position parameter
# above
frame=["x+lElevation", "y+lm"],
scale=10,
)
Expand Down
6 changes: 3 additions & 3 deletions examples/gallery/plot/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
The :meth:`pygmt.Figure.image` method can be used to read and
place a raster image file or an Encapsulated PostScript file
on a map. We must specify the file as *str* via the ``imagefile``
argument or simply use the filename as the first argument. You can
parameter or simply use the filename as the first argument. You can
also use a full URL pointing to your desired image. The ``position``
argument allows us to set a reference point on the map for the image.
parameter allows us to set a reference point on the map for the image.
"""
import os
Expand All @@ -25,7 +25,7 @@
box=True,
)

# clean up the image downloaded in the current directory
# clean up the downloaded image in the current directory
os.remove("gmt-logo.png")

fig.show()
2 changes: 1 addition & 1 deletion examples/gallery/plot/legend.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
The :meth:`pygmt.Figure.legend` method can automatically create a legend for
symbols plotted using :meth:`pygmt.Figure.plot`. Legend entries are only
created when the ``label`` argument is used.
created when the ``label`` parameter is used.
"""
import pygmt

Expand Down
4 changes: 2 additions & 2 deletions examples/gallery/plot/meca.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
The :meth:`pygmt.Figure.meca` method can plot focal mechanisms, or beachballs.
We can specify the focal mechanism nodal planes or moment tensor components as
a dict using the ``spec`` argument (or they can be specified as a 1d or 2d array,
a dict using the ``spec`` parameter (or they can be specified as a 1d or 2d array,
or within a specified file). The size of plotted beachballs can be specified
using the ``scale`` argument.
using the ``scale`` parameter.
"""

import pygmt
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/plot/multi-parameter-symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
-------------------------
The :meth:`pygmt.Figure.plot` method can plot individual multi-parameter symbols by passing
the corresponding shortcuts listed below to the ``style`` argument. Additionally, we must define
the corresponding shortcuts listed below to the ``style`` parameter. Additionally, we must define
the required parameters in a 2d list or numpy array (``[[parameters]]`` for a single symbol
or ``[[parameters_1],[parameters_2],[parameters_i]]`` for several ones) or use an
appropriately formatted input file and pass it to ``data``.
Expand Down
4 changes: 2 additions & 2 deletions examples/gallery/plot/points-transparency.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Points with varying transparency
--------------------------------
Points can be plotted with different transparency levels by passing in an array to the
``transparency`` argument of :meth:`pygmt.Figure.plot`.
Points can be plotted with different transparency levels by passing in an array
argument to the ``transparency`` parameter of :meth:`pygmt.Figure.plot`.
"""

import numpy as np
Expand Down
4 changes: 2 additions & 2 deletions examples/gallery/plot/points.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Points
------
The :meth:`pygmt.Figure.plot` method can plot points. We must specify the plot symbol
and size through the ``style`` argument.
The :meth:`pygmt.Figure.plot` method can plot points. The plot symbol and size
is set with the ``style`` parameter.
"""
import numpy as np
import pygmt
Expand Down
4 changes: 2 additions & 2 deletions examples/gallery/plot/scatter3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
In the example below, we show how the
`Iris flower dataset <https://en.wikipedia.org/wiki/Iris_flower_data_set>`__
can be visualized using a perspective 3-dimensional plot. The ``region``
argument has to include the :math:`x`, :math:`y`, :math:`z` axis limits in the
parameter has to include the :math:`x`, :math:`y`, :math:`z` axis limits in the
form of (xmin, xmax, ymin, ymax, zmin, zmax), which can be done automatically
using :meth:`pygmt.info`. To include the z-axis stick, set ``frame`` as a
using :meth:`pygmt.info`. To plot the z-axis frame, set ``frame`` as a
minimum to something like ``frame=["WsNeZ", "zaf"]``. Use ``perspective`` to
control the azimuth and elevation angle of the view, and ``zscale`` to adjust
the vertical exaggeration factor.
Expand Down
10 changes: 5 additions & 5 deletions examples/projections/README.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Projections
===========

PyGMT support many map projections. Use the ``projection`` argument to specify which one
you want to use in all plotting modules. The projection is specified by a one letter
code along with (sometimes optional) reference longitude and latitude and the width of
the map (for example, **A**\ *lon0/lat0*\ [*/horizon*\ ]\ */width*). The map height is
determined based on the region and projection.
PyGMT support many map projections. Use the ``projection`` parameter to specify which
one you want to use in all plotting modules. The projection is specified by a one
letter code along with (sometimes optional) reference longitude and latitude and the
width of the map (for example, **A**\ *lon0/lat0*\ [*/horizon*\ ]\ */width*). The map
height is determined based on the region and projection.

These are all the available projections:
2 changes: 1 addition & 1 deletion examples/projections/nongeo/cartesian_linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

fig = pygmt.Figure()
fig.plot(
# The ``x`` and ``y`` arguments determine the coordinates of lines
# The x and y parameters determine the coordinates of lines
x=[3, 9, 2],
y=[4, 9, 37],
pen="3p,red",
Expand Down
6 changes: 3 additions & 3 deletions examples/tutorials/3d-perspective-image.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@

########################################################################################
# The :meth:`pygmt.Figure.grdview` method takes the ``grid`` input.
# The ``perspective`` argument changes the azimuth and elevation of the viewpoint; the
# The ``perspective`` parameter changes the azimuth and elevation of the viewpoint; the
# default is [180, 90], which is looking directly down on the figure and north is "up".
# The ``zsize`` argument sets how tall the three-dimensional portion appears.
# The ``zsize`` parameter sets how tall the three-dimensional portion appears.
#
# The default grid surface type is *mesh plot*.

Expand Down Expand Up @@ -62,7 +62,7 @@
fig.show()

########################################################################################
# The ``plane`` argument sets the elevation and color of a plane that provides a fill
# The ``plane`` parameter sets the elevation and color of a plane that provides a fill
# below the surface relief.

fig = pygmt.Figure()
Expand Down
13 changes: 7 additions & 6 deletions examples/tutorials/first-figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,13 @@
# ``ps*`` modules had their ``ps`` prefix removed. The exceptions are:
# ``psxy`` which is now ``plot``, ``psxyz`` which is now ``plot3d``, and ``psscale``
# which is now ``colorbar``.
# 2. The arguments don't use the GMT 1-letter syntax (R, J, B, etc). We use longer
# aliases for these arguments and have some Python exclusive names. The mapping
# between the GMT arguments and their Python counterparts should be straight forward.
# 3. Arguments like ``region`` can take lists as well as strings like ``1/2/3/4``.
# 4. If a GMT argument has no options (like ``-B`` instead of ``-Baf``), use a ``True``
# in Python. An empty string would also be acceptable. For repeated arguments, such
# 2. The parameters don't use the GMT 1-letter syntax (**R**, **J**, **B**, etc). We use longer
# aliases for these parameters and have some Python exclusive names. The mapping
# between the GMT parameters and their Python counterparts should be straight
# forward.
# 3. Parameters like ``region`` can take lists as well as strings like ``1/2/3/4``.
# 4. If a GMT parameter has no options (like ``-B`` instead of ``-Baf``), use a ``True``
# in Python. An empty string would also be acceptable. For repeated parameters, such
# as ``-B+Loleron -Bxaf -By+lm``, provide a list: ``frame=["+Loleron", "xaf", "y+lm"]``.
# 5. There is no output redirecting to a PostScript file. The figure is generated in the
# background and will only be shown or saved when you ask for it.
8 changes: 4 additions & 4 deletions examples/tutorials/frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Frames, ticks, titles, and labels
=================================
Setting the style of the map frames, ticks, etc, is handled by the ``frame`` argument
Setting the style of the map frames, ticks, etc, is handled by the ``frame`` parameter
that all plotting methods of :class:`pygmt.Figure`.
.. note::
Expand Down Expand Up @@ -62,7 +62,7 @@
# Title
# -----
#
# The figure title can be set by passing **+t**\ *title* to the ``frame`` argument of
# The figure title can be set by passing **+t**\ *title* to the ``frame`` parameter of
# :meth:`pygmt.Figure.basemap`. Passing multiple arguments to ``frame`` can be done by
# using a list, as show in the example below.

Expand All @@ -75,7 +75,7 @@
########################################################################################
# To use a title with multiple words, the title must be placed inside another set of
# quotation marks. To prevent the quotation marks from appearing in the figure title,
# the ``frame`` argument can be passed in single quotation marks and the title can be
# the ``frame`` parameter can be passed in single quotation marks and the title can be
# passed in double quotation marks.

fig = pygmt.Figure()
Expand All @@ -89,7 +89,7 @@
# -----------
#
# Axis labels can be set by passing **x+l**\ *label* (or starting with **y** if
# labeling the y-axis) to the ``frame`` argument of :meth:`pygmt.Figure.basemap`.
# labeling the y-axis) to the ``frame`` parameter of :meth:`pygmt.Figure.basemap`.
# By default, all 4 map boundaries (or plot axes) are plotted with both tick marks and
# axis labels. The axes are named as **W** (west/left), **S** (south/bottom),
# **N** (north/top), and **E** (east/right) sides of a figure. If an upper-case axis
Expand Down
6 changes: 3 additions & 3 deletions examples/tutorials/inset.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
########################################################################################
#
# The :meth:`pygmt.Figure.inset` method uses a context manager, and is called using a
# ``with`` statement. The ``position`` argument, including the inset width, is required
# to plot the inset. Using the **j** argument, the location of the inset is
# ``with`` statement. The ``position`` parameter, including the inset width, is
# required to plot the inset. Using the **j** argument, the location of the inset is
# set to one of the 9 anchors (bottom-middle-top and left-center-right). In the
# example below, ``BL`` sets the inset to the bottom left. The ``box`` argument can
# example below, ``BL`` sets the inset to the bottom left. The ``box`` parameter can
# set the fill and border of the inset. In the example below, ``+pblack`` sets the
# border color to black and ``+gred`` sets the fill to red.

Expand Down
10 changes: 5 additions & 5 deletions examples/tutorials/lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# Plot lines
# ----------
#
# Create a Cartesian figure using ``projection`` argument and set the axis scales
# Create a Cartesian figure using ``projection`` parameter and set the axis scales
# using ``region`` (in this case, each axis is 0-10). Pass a list of ``x`` and ``y``
# values to be plotted as a line.

Expand Down Expand Up @@ -72,7 +72,7 @@
# Change line attributes
# ----------------------
#
# The line attributes can be set by the ``pen`` argument. ``pen`` takes a string
# The line attributes can be set by the ``pen`` parameter. ``pen`` takes a string
# argument with the optional values *width*,\ *color*,\ *style*.
#
# In the example below, the pen width is set to ``5p``, and with ``black`` as the
Expand All @@ -90,7 +90,7 @@
fig.show()

########################################################################################
# The line color can be set and is added after the line width to the ``pen`` argument.
# The line color can be set and is added after the line width to the ``pen`` parameter.
# In the example below, the line color is set to ``red``.

fig = pygmt.Figure()
Expand All @@ -106,7 +106,7 @@

########################################################################################
# The line style can be set and is added after the line width or color to the
# ``pen`` argument. In the example below, the line style is set to
# ``pen`` parameter. In the example below, the line style is set to
# ``..-`` (*dot dot dash*), and the default color ``black`` is used.

fig = pygmt.Figure()
Expand All @@ -121,7 +121,7 @@
fig.show()

########################################################################################
# The line width, color, and style can all be set in the same ``pen`` argument. In the
# The line width, color, and style can all be set in the same ``pen`` parameter. In the
# example below, the line width is set to ``7p``, the color is set to ``green``, and the
# line style is ``-.-`` (*dash dot dash*).
#
Expand Down
4 changes: 2 additions & 2 deletions examples/tutorials/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@

########################################################################################
# We used the style ``c0.3c`` which means "circles of 0.3 centimeter size". The ``pen``
# argument controls the outline of the symbols and the ``color`` controls the fill.
# parameter controls the outline of the symbols and the ``color`` controls the fill.
#
# We can map the size of the circles to the earthquake magnitude by passing an array to
# the ``sizes`` argument. Because the magnitude is on a logarithmic scale, it helps to
# the ``sizes`` parameter. Because the magnitude is on a logarithmic scale, it helps to
# show the differences by scaling the values using a power law.

fig = pygmt.Figure()
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorials/regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Set the region
==============
Many of the plotting functions take the ``region`` argument, which sets
Many of the plotting functions take the ``region`` parameter, which sets
the area that will be shown in the figure. This tutorial covers the different types of
inputs that it can accept.
Expand Down
Loading

0 comments on commit 34b30aa

Please sign in to comment.