Skip to content

Commit 81fb2e2

Browse files
DOC: Update Figure.grdview (#3824)
1 parent 59ccf4f commit 81fb2e2

File tree

1 file changed

+46
-51
lines changed

1 file changed

+46
-51
lines changed

pygmt/src/grdview.py

Lines changed: 46 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,11 @@ def grdview(self, grid, **kwargs):
3535
r"""
3636
Create 3-D perspective image or surface mesh from a grid.
3737
38-
Reads a 2-D grid file and produces a 3-D perspective plot by drawing a
39-
mesh, painting a colored/gray-shaded surface made up of polygons, or by
40-
scanline conversion of these polygons to a raster image. Options
41-
include draping a data set on top of a surface, plotting of contours on
42-
top of the surface, and apply artificial illumination based on
43-
intensities provided in a separate grid file.
38+
Reads a 2-D grid file and produces a 3-D perspective plot by drawing a mesh,
39+
painting a colored/gray-shaded surface made up of polygons, or by scanline
40+
conversion of these polygons to a raster image. Options include draping a data
41+
set on top of a surface, plotting of contours on top of the surface, and apply
42+
artificial illumination based on intensities provided in a separate grid file.
4443
4544
Full option list at :gmt-docs:`grdview.html`
4645
@@ -51,58 +50,55 @@ def grdview(self, grid, **kwargs):
5150
{grid}
5251
region : str or list
5352
*xmin/xmax/ymin/ymax*\ [**+r**][**+u**\ *unit*].
54-
Specify the :doc:`region </tutorials/basics/regions>` of interest.
55-
When used with ``perspective``, optionally append */zmin/zmax* to
56-
indicate the range to use for the 3-D axes [Default is the region in
57-
the input grid].
53+
Specify the :doc:`region </tutorials/basics/regions>` of interest. When used
54+
with ``perspective``, optionally append */zmin/zmax* to indicate the range to
55+
use for the 3-D axes [Default is the region given by the input grid].
5856
{projection}
5957
zscale/zsize : float or str
6058
Set z-axis scaling or z-axis size.
6159
{frame}
6260
cmap : str
6361
The name of the color palette table to use.
6462
drapegrid : str or :class:`xarray.DataArray`
65-
The file name or a DataArray of the image grid to be draped on top
66-
of the relief provided by ``grid`` [Default determines colors from grid].
67-
Note that ``zscale`` and ``plane`` always refer to the grid.
68-
The drapegrid only provides the information pertaining to colors, which
69-
(if drapegrid is a grid) will be looked-up via the CPT (see ``cmap``).
63+
The file name or a :class:`xarray.DataArray` of the image grid to be draped on
64+
top of the relief provided by ``grid`` [Default determines colors from ``grid``]
65+
Note that ``zscale`` and ``plane`` always refer to ``grid``. ``drapegrid`` only
66+
provides the information pertaining to colors, which (if ``drapegrid`` is a
67+
grid) will be looked-up via the CPT (see ``cmap``).
7068
plane : float or str
7169
*level*\ [**+g**\ *fill*].
72-
Draw a plane at this z-level. If the optional color is provided
73-
via the **+g** modifier, and the projection is not oblique, the frontal
74-
facade between the plane and the data perimeter is colored.
70+
Draw a plane at this z-level. If the optional color is provided via the **+g**
71+
modifier, and the projection is not oblique, the frontal facade between the
72+
plane and the data perimeter is colored.
7573
surftype : str
76-
Specify cover type of the grid.
77-
Select one of following settings:
74+
Specify cover type of the grid. Select one of following settings:
7875
7976
- **m**: mesh plot [Default].
8077
- **mx** or **my**: waterfall plots (row or column profiles).
81-
- **s**: surface plot, and optionally append **m** to have mesh lines
82-
drawn on top of the surface.
78+
- **s**: surface plot, and optionally append **m** to have mesh lines drawn on
79+
top of the surface.
8380
- **i**: image plot.
8481
- **c**: Same as **i** but will make nodes with z = NaN transparent.
8582
86-
For any of these choices, you may force a monochrome image by
87-
appending the modifier **+m**.
83+
For any of these choices, you may force a monochrome image by appending the
84+
modifier **+m**.
8885
contourpen : str
89-
Draw contour lines on top of surface or mesh (not image). Append
90-
pen attributes used for the contours.
86+
Draw contour lines on top of surface or mesh (not image). Append pen attributes
87+
used for the contours.
9188
meshpen : str
92-
Set the pen attributes used for the mesh. You must also select
93-
``surftype`` of **m** or **sm** for meshlines to be drawn.
89+
Set the pen attributes used for the mesh. You must also select ``surftype`` of
90+
**m** or **sm** for meshlines to be drawn.
9491
facadepen :str
95-
Set the pen attributes used for the facade. You must also select
96-
``plane`` for the facade outline to be drawn.
92+
Set the pen attributes used for the facade. You must also select ``plane`` for
93+
the facade outline to be drawn.
9794
shading : str
98-
Provide the name of a grid file with intensities in the (-1,+1)
99-
range, or a constant intensity to apply everywhere (affects the
100-
ambient light). Alternatively, derive an intensity grid from the
101-
input data grid reliefgrid via a call to :func:`pygmt.grdgradient`;
102-
append **+a**\ *azimuth*, **+n**\ *args*, and **+m**\ *ambient* to
103-
specify azimuth, intensity, and ambient arguments for that function,
104-
or just give **+d** to select the default arguments
105-
[Default is **+a**\ -45\ **+nt**\ 1\ **+m**\ 0].
95+
Provide the name of a grid file with intensities in the (-1,+1) range, or a
96+
constant intensity to apply everywhere (affects the ambient light).
97+
Alternatively, derive an intensity grid from the main input data grid by using
98+
:func:`pygmt.grdgradient` first; append **+a**\ *azimuth*, **+n**\ *args*, and
99+
**+m**\ *ambient* to specify azimuth, intensity, and ambient arguments for that
100+
function, or just give **+d** to select the default arguments [Default is
101+
"+a-45+nt1+m0"].
106102
{verbose}
107103
{panel}
108104
{coltypes}
@@ -113,34 +109,33 @@ def grdview(self, grid, **kwargs):
113109
Example
114110
-------
115111
>>> import pygmt
116-
>>> # load the 30 arc-minutes grid with "gridline" registration
117-
>>> # in a specified region
112+
>>> # Load the 30 arc-minutes grid with "gridline" registration in a given region
118113
>>> grid = pygmt.datasets.load_earth_relief(
119114
... resolution="30m",
120115
... region=[-92.5, -82.5, -3, 7],
121116
... registration="gridline",
122117
... )
123-
>>> # create a new figure instance with pygmt.Figure()
118+
>>> # Create a new figure instance with pygmt.Figure()
124119
>>> fig = pygmt.Figure()
125-
>>> # create the contour plot
120+
>>> # Create the contour plot
126121
>>> fig.grdview(
127-
... # pass in the grid downloaded above
122+
... # Pass in the grid downloaded above
128123
... grid=grid,
129-
... # set the perspective to an azimuth of 130° and an elevation of 30°
124+
... # Set the perspective to an azimuth of 130° and an elevation of 30°
130125
... perspective=[130, 30],
131-
... # add a frame to the x- and y-axes
132-
... # specify annotations on the south and east borders of the plot
126+
... # Add a frame to the x- and y-axes
127+
... # Specify annotations on the south and east borders of the plot
133128
... frame=["xa", "ya", "wSnE"],
134-
... # set the projection of the 2-D map to Mercator with a 10 cm width
129+
... # Set the projection of the 2-D map to Mercator with a 10 cm width
135130
... projection="M10c",
136-
... # set the vertical scale (z-axis) to 2 cm
131+
... # Set the vertical scale (z-axis) to 2 cm
137132
... zsize="2c",
138-
... # set "surface plot" to color the surface via a CPT
133+
... # Set "surface plot" to color the surface via a CPT
139134
... surftype="s",
140-
... # specify CPT to "geo"
135+
... # Specify CPT to "geo"
141136
... cmap="geo",
142137
... )
143-
>>> # show the plot
138+
>>> # Show the plot
144139
>>> fig.show()
145140
"""
146141
kwargs = self._preprocess(**kwargs)

0 commit comments

Comments
 (0)