Skip to content

Commit 3657859

Browse files
authored
DOC: Use the EU flag image from the GMT data server in the 'Draping on 3-D surface' example (#4432)
1 parent bf94645 commit 3657859

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

examples/tutorials/advanced/draping_on_3d_surface.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
This tutorial consists of two examples:
99
1010
1. Draping a grid
11-
1211
2. Draping an image
1312
"""
1413

@@ -53,7 +52,7 @@
5352
pygmt.makecpt(cmap="SCM/batlow", series=[0, 200, 1], reverse=True, overrule_bg=True)
5453

5554
fig.grdview(
56-
projection="M12c", # Mercator projection with a width of 12 centimeters
55+
projection="M12c", # Mercator projection with a width of 12 cm
5756
region=region_3d,
5857
grid=grd_relief, # Use elevation grid for z values
5958
drape_grid=grd_age, # Use crustal age grid for color-coding
@@ -96,9 +95,11 @@
9695
# Determine the 3-D region from the minimum and maximum values of the relief grid
9796
region_3d = [*region_2d, grd_relief.min().to_numpy(), grd_relief.max().to_numpy()]
9897

99-
# Download an PNG image of the flag of the EU using rasterio and load it into a
100-
# xarray.DataArray
101-
url_to_image = "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b7/Flag_of_Europe.svg/1024px-Flag_of_Europe.svg.png"
98+
# Load a PNG image of the EU flag using rasterio into an xarray.DataArray.
99+
# The original image is available on Wikimedia Commons at
100+
# https://upload.wikimedia.org/wikipedia/commons/thumb/b/b7/Flag_of_Europe.svg/1024px-Flag_of_Europe.svg.png
101+
# but we use a cached version on the GMT data server.
102+
url_to_image = "https://oceania.generic-mapping-tools.org/cache/euflag.png"
102103
with rasterio.open(url_to_image) as dataset:
103104
data = dataset.read()
104105
drape_grid = xr.DataArray(data, dims=("band", "y", "x"))
@@ -117,7 +118,7 @@
117118
pygmt.makecpt(cmap="0/51/153,255/204/0", series=[0, 256, 128])
118119

119120
fig.grdview(
120-
projection="M12c", # Mercator projection with a width of 12 centimeters
121+
projection="M12c", # Mercator projection with a width of 12 cm
121122
region=region_3d,
122123
grid=grd_relief, # Use elevation grid for z values
123124
drape_grid=drape_grid, # Drape image grid for the EU flag on top
@@ -126,7 +127,7 @@
126127
# Use an illumination from the azimuthal directions 0° (north) and 270° (west) with
127128
# a normalization via a cumulative Laplace distribution for the shading
128129
shading="+a0/270+ne0.6",
129-
perspective=[157.5, 30], # Define azimuth, elevation for the 3-D plot
130+
perspective=(157.5, 30), # Define azimuth, elevation for the 3-D plot
130131
zsize="1c",
131132
facade_fill="darkgray",
132133
frame=True,

0 commit comments

Comments
 (0)