Skip to content

Commit 831d5c2

Browse files
committed
Update existing gallery examples
1 parent 19cd544 commit 831d5c2

File tree

3 files changed

+16
-20
lines changed

3 files changed

+16
-20
lines changed

examples/gallery/3d_plots/grdview_surface.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
==================
44
55
The :meth:`pygmt.Figure.grdview()` method can plot 3-D surfaces with
6-
``surftype="s"``. Here, we supply the data as an :class:`xarray.DataArray` with
7-
the coordinate vectors ``x`` and ``y`` defined. Note that the ``perspective``
8-
parameter here controls the azimuth and elevation angle of the view. We provide
9-
a list of two arguments to ``frame`` - the first argument specifies the
10-
:math:`x`- and :math:`y`-axes frame attributes and the second argument,
11-
prepended with ``"z"``, specifies the :math:`z`-axis frame attributes.
12-
Specifying the same scale for the ``projection`` and ``zscale`` parameters
13-
ensures equal axis scaling. The ``shading`` parameter specifies illumination;
14-
here we choose an azimuth of 45° with ``shading="+a45"``.
6+
``surftype="surface"``. Here, we supply the data as an :class:`xarray.DataArray` with
7+
the coordinate vectors ``x`` and ``y`` defined. Note that the ``perspective`` parameter
8+
here controls the azimuth and elevation angle of the view. We provide a list of two
9+
arguments to ``frame`` - the first argument specifies the :math:`x`- and :math:`y`-axes
10+
frame attributes and the second argument, prepended with ``"z"``, specifies the
11+
:math:`z`-axis frame attributes. Specifying the same scale for the ``projection`` and
12+
``zscale`` parameters ensures equal axis scaling. The ``shading`` parameter specifies
13+
illumination; here we choose an azimuth of 45° with ``shading="+a45"``.
1514
"""
1615

1716
# %%
@@ -46,12 +45,11 @@ def ackley(x, y):
4645
SCALE = 0.5 # in centimeters
4746
fig.grdview(
4847
data,
49-
# Set annotations and gridlines in steps of five, and
50-
# tick marks in steps of one
48+
# Set annotations and gridlines in steps of five, and tick marks in steps of one
5149
frame=["a5f1g5", "za5f1g5"],
5250
projection=f"x{SCALE}c",
5351
zscale=f"{SCALE}c",
54-
surftype="s",
52+
surftype="surface",
5553
cmap="roma",
5654
perspective=[135, 30], # Azimuth southeast (135°), at elevation 30°
5755
shading="+a45",

examples/tutorials/advanced/3d_perspective_image.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,8 @@
4747
frame=["xa", "yaf", "WSnE"],
4848
projection="M15c",
4949
zsize="1.5c",
50-
# Set the surftype to "surface"
51-
surftype="s",
52-
# Set the CPT to "geo"
53-
cmap="geo",
50+
surftype="surface",
51+
cmap="geo", # Set the CPT to "geo"
5452
)
5553
fig.show()
5654

@@ -65,7 +63,7 @@
6563
frame=["xa", "yaf", "WSnE"],
6664
projection="M15c",
6765
zsize="1.5c",
68-
surftype="s",
66+
surftype="surface",
6967
cmap="geo",
7068
# Set the plane elevation to 1,000 meters and make the fill "gray"
7169
plane="1000+ggray",
@@ -88,7 +86,7 @@
8886
frame=["xaf", "yaf", "WSnE"],
8987
projection="M15c",
9088
zsize="1.5c",
91-
surftype="s",
89+
surftype="surface",
9290
cmap="geo",
9391
plane="1000+ggrey",
9492
# Set the contour pen thickness to "0.1p"

examples/tutorials/advanced/draping_on_3d_surface.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
grid=grd_relief, # Use elevation grid for z values
5959
drapegrid=grd_age, # Use crustal age grid for color-coding
6060
cmap=True, # Use colormap created for the crustal age
61-
surftype="i", # Create an image plot
61+
surftype="image", # Create an image plot
6262
# Use an illumination from the azimuthal directions 0° (north) and 270°
6363
# (west) with a normalization via a cumulative Laplace distribution for
6464
# the shading
@@ -122,7 +122,7 @@
122122
grid=grd_relief, # Use elevation grid for z values
123123
drapegrid=drapegrid, # Drap image grid for the EU flag on top
124124
cmap=True, # Use colormap defined for the EU flag
125-
surftype="i", # Create an image plot
125+
surftype="image", # Create an image plot
126126
# Use an illumination from the azimuthal directions 0° (north) and 270° (west) with
127127
# a normalization via a cumulative Laplace distribution for the shading
128128
shading="+a0/270+ne0.6",

0 commit comments

Comments
 (0)