Skip to content

Commit b70080a

Browse files
Correct and consistent usage of 'function, 'method', and 'class' (#2043)
1 parent 91a501f commit b70080a

34 files changed

+73
-72
lines changed

doc/api/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Saving and displaying the figure
8484
Configuring the display settings
8585
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8686

87-
The following module is provided directly through the :mod:`pygmt` top level
87+
The following function is provided directly through the :mod:`pygmt` top level
8888
package.
8989

9090
.. autosummary::
@@ -95,7 +95,7 @@ package.
9595
Color palette table generation
9696
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9797

98-
The following modules are provided directly through the :mod:`pygmt` top level
98+
The following functions are provided directly through the :mod:`pygmt` top level
9999
package.
100100

101101
.. autosummary::

doc/contributing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ Guidelines for a good tutorial:
392392
concise examples while the tutorials are detailed and full of text.
393393
* SI units should be used in the example code for tutorial plots.
394394

395-
Note that the `Figure.show()` function needs to be called for a plot to be inserted into
395+
Note that the `Figure.show()` method needs to be called for a plot to be inserted into
396396
the documentation.
397397

398398
### Editing the API Documentation
@@ -576,7 +576,7 @@ returning the `pygmt.Figure` object:
576576
```python
577577
@pytest.mark.mpl_image_compare
578578
def test_my_plotting_case():
579-
"Test that my plotting function works"
579+
"Test that my plotting method works"
580580
fig = Figure()
581581
fig.basemap(region=[0, 360, -90, 90], projection='W7i', frame=True)
582582
return fig
@@ -682,7 +682,7 @@ Here's an example:
682682
```python
683683
@check_figures_equal()
684684
def test_my_plotting_case():
685-
"Test that my plotting function works"
685+
"Test that my plotting method works"
686686
fig_ref, fig_test = Figure(), Figure()
687687
fig_ref.grdimage("@earth_relief_01d_g", projection="W120/15c", cmap="geo")
688688
fig_test.grdimage(grid, projection="W120/15c", cmap="geo")

examples/gallery/3d_plots/scatter3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
can be visualized using a perspective 3D plot. The ``region``
99
parameter has to include the :math:`x`, :math:`y`, :math:`z` axis limits in the
1010
form of (xmin, xmax, ymin, ymax, zmin, zmax), which can be done automatically
11-
using :meth:`pygmt.info`. To plot the z-axis frame, set ``frame`` as a
11+
using :func:`pygmt.info`. To plot the z-axis frame, set ``frame`` as a
1212
minimum to something like ``frame=["WsNeZ", "zaf"]``. Use ``perspective`` to
1313
control the azimuth and elevation angle of the view, and ``zscale`` to adjust
1414
the vertical exaggeration factor.

examples/gallery/embellishments/colorbars_multiple.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
nrows=1, ncols=2, figsize=("15c", "8c"), autolabel=True, margins="0.5c"
2424
):
2525
# Activate the first panel so that the colormap created by the makecpt
26-
# method is a panel-level CPT
26+
# function is a panel-level CPT
2727
with fig.set_panel(panel=0):
2828
pygmt.makecpt(cmap="geo", series=[-8000, 8000])
2929
# "R?" means Winkel Tripel projection with map width automatically
3030
# determined from the subplot width.
3131
fig.grdimage(grid=grid_globe, projection="R?", region="g", frame="a")
3232
fig.colorbar(frame=["a4000f2000", "x+lElevation", "y+lm"])
3333
# Activate the second panel so that the colormap created by the makecpt
34-
# method is a panel-level CPT
34+
# function is a panel-level CPT
3535
with fig.set_panel(panel=1):
3636
pygmt.makecpt(cmap="globe", series=[-6000, 3000])
3737
# "M?" means Mercator projection with map width also automatically

examples/gallery/embellishments/inset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
-----
44
55
The :meth:`pygmt.Figure.inset` method adds an inset figure inside a larger
6-
figure. The function is called using a ``with`` statement, and its
6+
figure. The method is called using a ``with`` statement, and its
77
``position``, ``box``, ``offset``, and ``margin`` parameters are set. Plotting
88
methods called within the ``with`` statement are applied to the inset figure.
99
"""

examples/gallery/embellishments/inset_rectangle_region.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
--------------------------------------
44
55
The :meth:`pygmt.Figure.inset` method adds an inset figure inside a larger
6-
figure. The function is called using a ``with`` statement, and its
6+
figure. The method is called using a ``with`` statement, and its
77
``position``, ``box``, ``offset``, and ``margin`` can be customized. Plotting
88
methods called within the ``with`` statement plot into the inset figure.
99
"""

examples/gallery/histograms/blockm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
Blockmean
33
---------
4-
The :meth:`pygmt.blockmean` method calculates different quantities
4+
The :func:`pygmt.blockmean` function calculates different quantities
55
inside blocks/bins whose dimensions are defined via the ``spacing`` parameter.
66
The following examples show how to calculate the averages of the given values
77
inside each bin and how to report the number of points inside each bin.

examples/gallery/images/grdclip.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"""
22
Clipping grid values
33
--------------------
4-
The :meth:`pygmt.grdclip` method allows to clip defined ranges of grid values.
5-
In the example shown below we set all elevation values (grid points) smaller
6-
than 0 m (in general the bathymetric part of the grid) to a common value of
7-
-2000 m via the ``below`` parameter.
4+
The :func:`pygmt.grdclip` function allows to clip defined ranges of grid
5+
values. In the example shown below we set all elevation values (grid points)
6+
smaller than 0 m (in general the bathymetric part of the grid) to a common
7+
value of -2000 m via the ``below`` parameter.
88
"""
99

1010
import pygmt

examples/gallery/images/grdgradient.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""
22
Calculating grid gradient and radiance
33
--------------------------------------
4-
The :meth:`pygmt.grdgradient` method calculates the gradient of a grid file.
4+
The :func:`pygmt.grdgradient` function calculates the gradient of a grid file.
55
In the example shown below we will see how to calculate a hillshade map based
6-
on a Data Elevation Model (DEM). As input :meth:`pygmt.grdgradient` gets
6+
on a Data Elevation Model (DEM). As input :func:`pygmt.grdgradient` gets
77
a :class:`xarray.DataArray` object or a path string to a grid file, calculates
88
the respective gradient and returns it as an :class:`xarray.DataArray` object.
99
We will use the ``radiance`` parameter in order to set the illumination source

examples/gallery/images/grdlandmask.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
Create 'wet-dry' mask grid
33
--------------------------
4-
The :meth:`pygmt.grdlandmask` method allows setting
4+
The :func:`pygmt.grdlandmask` function allows setting
55
all nodes on land or water to a specified value using
66
the ``maskvalues`` parameter.
77
"""

examples/gallery/lines/great_circles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Generate points along great circles
33
-----------------------------------
44
5-
The :meth:`pygmt.project` method can generate points along a great circle
5+
The :func:`pygmt.project` function can generate points along a great circle
66
whose center and end points can be defined via the ``center`` and ``endpoint``
77
parameters, respectively. Using the ``generate`` parameter allows to generate
88
(*r*, *s*, *p*) points every *dist* units of *p* along a profile as

examples/gallery/symbols/points_categorical.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
can be visualized. Here, we can pass the individual categories included in
88
the "species" column directly to the ``color`` parameter via
99
``color=df.species.cat.codes.astype(int)``. Additionally, we have to set
10-
``cmap=True``. A desired colormap can be selected via the :meth:`pygmt.makecpt`
11-
method.
10+
``cmap=True``. A desired colormap can be selected via the :func:`pygmt.makecpt`
11+
function.
1212
"""
1313

1414
import pandas as pd

examples/get-started/first_figure.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
3737
fig = pygmt.Figure()
3838

3939
###############################################################################
40-
# To add to a plot object (``fig`` in this example), the PyGMT module is used
41-
# as a method on the class. This example will use the
40+
# To add elements to the figure instance or object (``fig`` in this example)
41+
# different methods can be called on it. This example will use the
4242
# :meth:`pygmt.Figure.coast` method, which can be used to create a map without
43-
# any other methods, modules or external data. The :meth:`pygmt.Figure.coast`
43+
# any other methods or external data. The :meth:`pygmt.Figure.coast`
4444
# method plots the coastlines, borders, and bodies of water using a database
4545
# that is included in GMT.
4646
#

examples/tutorials/advanced/configuration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
# ----------------------------------
1515
#
1616
# Users can override default parameters either temporarily (locally) or
17-
# permanently (globally) using :meth:`pygmt.config`. The full list of default
17+
# permanently (globally) using :class:`pygmt.config`. The full list of default
1818
# parameters that can be changed can be found at :gmt-docs:`gmt.conf.html`.
1919
#
20-
# We demonstrate the usage of :meth:`pygmt.config` by configuring a map plot.
20+
# We demonstrate the usage of :class:`pygmt.config` by configuring a map plot.
2121

2222
# Start with a basic figure with the default style
2323
fig = pygmt.Figure()

examples/tutorials/advanced/date_time_charts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@
237237
#
238238
# Another way of creating charts involving datetime data can be done
239239
# by automatically generating the region of the plot. This can be done
240-
# by passing the dataframe to :meth:`pygmt.info`, which will find
240+
# by passing the dataframe to :func:`pygmt.info`, which will find
241241
# maximum and minimum values for each column and create a list
242242
# that could be passed as region. Additionally, the ``spacing`` argument
243243
# can be passed to increase the range past the maximum and minimum

examples/tutorials/advanced/earth_relief.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
=====================
44
55
Plotting a map of Earth relief can use the data accessed by the
6-
:meth:`pygmt.datasets.load_earth_relief` method. The data can then be plotted
7-
using the :meth:`pygmt.Figure.grdimage` method.
6+
:func:`pygmt.datasets.load_earth_relief` function. The data can then be
7+
plotted using the :meth:`pygmt.Figure.grdimage` method.
88
"""
99
# sphinx_gallery_thumbnail_number = 5
1010

@@ -86,7 +86,7 @@
8686
# -------------------
8787
#
8888
# In addition to providing global data, the ``region`` parameter for
89-
# :meth:`pygmt.datasets.load_earth_relief` can be used to provide data for a
89+
# :func:`pygmt.datasets.load_earth_relief` can be used to provide data for a
9090
# specific area. The ``region`` parameter is required for resolutions at 5 arc
9191
# minutes or higher, and accepts a list (as in the example below) or a string.
9292
# The geographic ranges are passed as *xmin*/*xmax*/*ymin*/*ymax*.

examples/tutorials/advanced/grid_equalization.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
Performing grid histogram equalization
33
======================================
4-
The :meth:`pygmt.grdhisteq.equalize_grid` function creates a grid using
4+
The :meth:`pygmt.grdhisteq.equalize_grid` method creates a grid using
55
statistics based on a cumulative distribution function.
66
"""
77
# sphinx_gallery_thumbnail_number = 3
@@ -12,7 +12,7 @@
1212
# Load sample data
1313
# ----------------
1414
# Load the sample Earth relief data for a region around Yosemite valley
15-
# and use :meth:`pygmt.grd2xyz` to create a :class:`pandas.Series` with the
15+
# and use :func:`pygmt.grd2xyz` to create a :class:`pandas.Series` with the
1616
# z-values.
1717

1818
grid = pygmt.datasets.load_earth_relief(

examples/tutorials/advanced/insets.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
frame="a",
5252
)
5353
with fig.inset(position="jBL+w3c", box="+pblack+glightred"):
54-
# pass is used to exit the with statement as no plotting functions are
54+
# pass is used to exit the with statement as no plotting methods are
5555
# called
5656
pass
5757
fig.show()
@@ -81,7 +81,7 @@
8181

8282
###############################################################################
8383
#
84-
# Standard plotting functions can be called from within the ``inset`` context
84+
# Standard plotting methods can be called from within the ``inset`` context
8585
# manager. The example below uses :meth:`pygmt.Figure.coast` to plot a zoomed
8686
# out map that selectively paints the state of Massachusetts to shows its
8787
# location relative to other states.
@@ -105,7 +105,7 @@
105105
region=[-80, -65, 35, 50],
106106
projection="M3c",
107107
):
108-
# Use a plotting function to create a figure inside the inset.
108+
# Use a plotting method to create a figure inside the inset.
109109
fig.coast(
110110
land="gray",
111111
borders=[1, 2],

examples/tutorials/advanced/subplots.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
# Define subplot layout
3232
# ---------------------
3333
#
34-
# The :meth:`pygmt.Figure.subplot` function is used to set up the layout, size,
34+
# The :meth:`pygmt.Figure.subplot` method is used to set up the layout, size,
3535
# and other attributes of the figure. It divides the whole canvas into regular
3636
# grid areas with *n* rows and *m* columns. Each grid area can contain an
3737
# individual subplot. For example:
@@ -62,8 +62,8 @@
6262
fig.show()
6363

6464
###############################################################################
65-
# The :meth:`pygmt.Figure.set_panel` function activates a specified subplot,
66-
# and all subsequent plotting functions will take place in that subplot panel.
65+
# The :meth:`pygmt.Figure.set_panel` method activates a specified subplot,
66+
# and all subsequent plotting methods will take place in that subplot panel.
6767
# This is similar to matplotlib's ``plt.sca`` method. In order to specify a
6868
# subplot, you will need to provide the identifier for that subplot via the
6969
# ``panel`` parameter. Pass in either the *index* number, or a tuple/list like
@@ -145,7 +145,7 @@
145145
###############################################################################
146146
# .. note::
147147
#
148-
# All plotting functions (e.g. :meth:`pygmt.Figure.coast`,
148+
# All plotting methods (e.g. :meth:`pygmt.Figure.coast`,
149149
# :meth:`pygmt.Figure.text`, etc) are able to use ``panel`` parameter when
150150
# in subplot mode. Once a panel is activated using ``panel`` or
151151
# :meth:`pygmt.Figure.set_panel`, subsequent plotting commands that don't

examples/tutorials/advanced/vectors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# The angle is measured in degrees and moves counter-clockwise from the
2323
# horizontal.
2424
# The length of the vector uses centimeters by default but
25-
# could be changed using :meth:`pygmt.config`
25+
# could be changed using :class:`pygmt.config`
2626
# (Check the next examples for unit changes).
2727
#
2828
# Notice that the ``v`` in the ``style`` parameter stands for

examples/tutorials/basics/plot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
# even use the new matplotlib colormap "viridis". Here, we first create a
7575
# continuous colormap ranging from the minimum depth to the maximum depth of
7676
# the earthquakes using :func:`pygmt.makecpt`, then set ``cmap=True`` in
77-
# :func:`pygmt.Figure.plot` to use the colormap. At the end of the plot, we
77+
# :meth:`pygmt.Figure.plot` to use the colormap. At the end of the plot, we
7878
# also plot a colorbar showing the colormap used in the plot.
7979
#
8080

examples/tutorials/basics/regions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Setting the region
33
==================
44
5-
Many of the plotting functions take the ``region`` parameter, which sets the
5+
Many of the plotting methods take the ``region`` parameter, which sets the
66
area that will be shown in the figure. This tutorial covers the different types
77
of inputs that it can accept.
88
"""

pygmt/figure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def psconvert(self, icc_gray=False, **kwargs):
146146
PDF, PNG, PPM, SVG, TIFF) using Ghostscript.
147147
148148
If no input files are given, will convert the current active figure
149-
(see :func:`pygmt.Figure`). In this case, an output name must be given
149+
(see :class:`pygmt.Figure`). In this case, an output name must be given
150150
using parameter *prefix*.
151151
152152
Full option list at :gmt-docs:`psconvert.html`

pygmt/src/grd2cpt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def grd2cpt(grid, **kwargs):
3333
r"""
3434
Make GMT color palette tables from a grid file.
3535
36-
This is a method that will help you make static color palette tables
36+
This is a function that will help you make static color palette tables
3737
(CPTs). By default, the CPT will simply be saved to the current session,
3838
but you can use ``output`` to save it to a file. The CPT is based on an
3939
existing dynamic master CPT of your choice, and the mapping from data value
@@ -61,7 +61,7 @@ def grd2cpt(grid, **kwargs):
6161
``overrule_bg`` or ``no_bg``.
6262
6363
The color model (RGB, HSV or CMYK) of the palette created by
64-
:meth:`pygmt.grd2cpt` will be the same as specified in the header of the
64+
:func:`pygmt.grd2cpt` will be the same as specified in the header of the
6565
master CPT. When there is no :gmt-term:`COLOR_MODEL` entry in the master
6666
CPT, the :gmt-term:`COLOR_MODEL` specified in the
6767
:gmt-docs:`gmt.conf <gmt.conf>` file or the ``color_model`` option will be

pygmt/src/grdcut.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def grdcut(grid, **kwargs):
3434
Produce a new ``outgrid`` file which is a subregion of ``grid``. The
3535
subregion is specified with ``region``; the specified range must not exceed
3636
the range of ``grid`` (but see ``extend``). If in doubt, run
37-
:meth:`pygmt.grdinfo` to check range. Alternatively, define the subregion
37+
:func:`pygmt.grdinfo` to check range. Alternatively, define the subregion
3838
indirectly via a range check on the node values or via distances from a
3939
given point. Finally, you can give ``projection`` for oblique projections
4040
to determine the corresponding rectangular ``region`` that will give a grid

0 commit comments

Comments
 (0)