Skip to content

Commit 8c5044e

Browse files
DOC/Gallery example "Blockmean": Migrate frame settings to the new Frame/Axis syntax (#4514)
1 parent 7b7a349 commit 8c5044e

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

examples/gallery/histograms/blockm.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
# %%
1212
import pygmt
13+
from pygmt.params import Axis, Frame
1314

1415
# Load sample data
1516
data = pygmt.datasets.load_sample_data(name="japan_quakes")
@@ -29,12 +30,15 @@
2930
# Convert to grid
3031
grd = pygmt.xyz2grd(data=df, region=region, spacing=spacing)
3132

32-
fig.grdimage(
33-
grid=grd,
33+
fig.basemap(
3434
region=region,
35-
frame=["af", "+tMean earthquake depth inside each block"],
36-
cmap="SCM/batlow",
35+
projection="M11c",
36+
frame=Frame(
37+
axis=Axis(annot=True, tick=True),
38+
title="Mean earthquake depth inside each block",
39+
),
3740
)
41+
fig.grdimage(grid=grd, cmap="SCM/batlow")
3842
# Plot slightly transparent landmasses on top
3943
fig.coast(land="darkgray", transparency=40)
4044
# Plot original data points
@@ -48,12 +52,14 @@
4852
df = pygmt.blockmean(data=data, region=region, spacing=spacing, summary="n")
4953
grd = pygmt.xyz2grd(data=df, region=region, spacing=spacing)
5054

51-
fig.grdimage(
52-
grid=grd,
55+
fig.basemap(
5356
region=region,
54-
frame=["af", "+tNumber of points inside each block"],
55-
cmap="SCM/batlow",
57+
projection="M11c",
58+
frame=Frame(
59+
axis=Axis(annot=True, tick=True), title="Number of points inside each block"
60+
),
5661
)
62+
fig.grdimage(grid=grd, cmap="SCM/batlow")
5763
fig.coast(land="darkgray", transparency=40)
5864
fig.plot(x=data.longitude, y=data.latitude, style="c0.3c", fill="white", pen="1p,black")
5965
fig.colorbar(label="Count")

0 commit comments

Comments
 (0)