Skip to content

Commit 7b7a349

Browse files
DOC/Gallery example "Inset": Migrate frame settings to the new Frame/Axis syntax (#4508)
1 parent 8962943 commit 7b7a349

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

examples/gallery/embellishments/inset.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,28 @@
99

1010
# %%
1111
import pygmt
12-
from pygmt.params import Box, Position
12+
from pygmt.params import Axis, Box, Position
1313

1414
fig = pygmt.Figure()
15-
# Create the primary figure, setting the region to Madagascar, the land color to
16-
# "brown", the water to "lightblue", the shorelines width to "thin", and adding a frame
17-
fig.coast(region="MG+r2", land="brown", water="lightblue", shorelines="thin", frame="a")
18-
# Create an inset, placing it in the Top Left (TL) corner with a width of 3.5 cm and
19-
# x- and y-offsets of 0.2 cm. The clearance is set to 0, and the border is "gold" with a
15+
# Create the primary figure, setting the region to Madagascar
16+
fig.basemap(region="MG+r2", projection="M12c", frame=Axis(annot=True))
17+
# Set the land color to "brown", the water color to "lightblue", and the shorelines
18+
# width to "thin"
19+
fig.coast(land="brown", water="lightblue", shorelines="thin")
20+
21+
# Create an inset, placing it in the Top Left (TL) corner with a width of 3.5 cm and x-
22+
# and y-offsets of 0.2 cm. The clearance is set to 0, and the border is "gold" with a
2023
# pen thickness of 1.5 points.
2124
with fig.inset(
2225
position=Position("TL", offset=0.2),
2326
width=3.5,
2427
clearance=0,
2528
box=Box(pen="1.5p,gold"),
2629
):
27-
# Create a figure in the inset using coast. This example uses the azimuthal
28-
# orthogonal projection centered at 47E, 20S. The land color is set to "gray" and
29-
# Madagascar is highlighted in "red3".
30-
fig.coast(
31-
region="g", projection="G47/-20/?", land="gray", water="white", dcw="MG+gred3"
32-
)
30+
# Create a map within the inset. This example uses the azimuthal orthogonal
31+
# projection centered at 47 E, 20 S. The question mark is required for the
32+
# automatic size determination by PyGMT
33+
fig.basemap(region="g", projection="G47/-20/?", frame=0)
34+
# Madagascar is highlighted in "red3"
35+
fig.coast(land="gray", water="white", dcw="MG+gred3")
3336
fig.show()

0 commit comments

Comments
 (0)