|
9 | 9 |
|
10 | 10 | # %% |
11 | 11 | import pygmt |
12 | | -from pygmt.params import Box, Position |
| 12 | +from pygmt.params import Axis, Box, Position |
13 | 13 |
|
14 | 14 | 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 |
20 | 23 | # pen thickness of 1.5 points. |
21 | 24 | with fig.inset( |
22 | 25 | position=Position("TL", offset=0.2), |
23 | 26 | width=3.5, |
24 | 27 | clearance=0, |
25 | 28 | box=Box(pen="1.5p,gold"), |
26 | 29 | ): |
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") |
33 | 36 | fig.show() |
0 commit comments