11
11
12
12
@fmt_docstring
13
13
@contextlib .contextmanager
14
- @use_alias (D = "position" , F = "box" , M = "margin" , N = "no_clip" , V = "verbose" )
15
- @kwargs_to_strings (D = "sequence" , M = "sequence" )
14
+ @use_alias (
15
+ D = "position" ,
16
+ F = "box" ,
17
+ J = "projection" ,
18
+ M = "margin" ,
19
+ N = "no_clip" ,
20
+ R = "region" ,
21
+ V = "verbose" ,
22
+ )
23
+ @kwargs_to_strings (D = "sequence" , M = "sequence" , R = "sequence" )
16
24
def inset (self , ** kwargs ):
17
25
r"""
18
26
Create an inset figure to be placed within a larger figure.
@@ -98,6 +106,8 @@ def inset(self, **kwargs):
98
106
no_clip : bool
99
107
Do NOT clip features extruding outside map inset boundaries [Default
100
108
is clip].
109
+ {R}
110
+ {J}
101
111
{V}
102
112
103
113
Examples
@@ -107,20 +117,22 @@ def inset(self, **kwargs):
107
117
>>> # Create the larger figure
108
118
>>> fig = pygmt.Figure()
109
119
>>> fig.coast(region="MG+r2", water="lightblue", shorelines="thin")
110
- >>> # Use a "with" statement to initialize the inset context manager
111
- >>> # Setting the position to top left and a width of 3.5 centimeters
112
- >>> with fig.inset(position="jTL+w3.5c+o0.2c", margin=0, box="+pgreen"):
113
- ... # Map elements under the "with" statement are plotted in the inset.
114
- ... # Use '?' when specifying the projection width, to automatically
115
- ... # determine the map size from the inset box size.
120
+ >>> # Use a "with" statement to initialize the inset context manager.
121
+ >>> # Seting the position to top left with an 0.2 cm offset and
122
+ >>> # draw a green inset box.
123
+ >>> # The inset size is determined by the region and projection parameters.
124
+ >>> with fig.inset(
125
+ ... position="jTL+o0.2c",
126
+ ... margin=0,
127
+ ... box="+pgreen",
128
+ ... region="g",
129
+ ... projection="G47/-20/3.5c",
130
+ ... ):
116
131
... fig.coast(
117
- ... region="g",
118
- ... projection="G47/-20/?",
119
132
... land="gray",
120
133
... water="white",
121
134
... dcw="MG+gred",
122
135
... )
123
- ...
124
136
>>> # Map elements outside the "with" block are plotted in the main figure
125
137
>>> fig.logo(position="jBR+o0.2c+w3c")
126
138
>>> fig.show() # doctest: +SKIP
0 commit comments