5
5
import contextlib
6
6
from typing import Literal
7
7
8
- from pygmt .alias import AliasSystem
8
+ from pygmt .alias import Alias , AliasSystem
9
9
from pygmt .clib import Session
10
10
from pygmt .helpers import build_arg_list , fmt_docstring , kwargs_to_strings , use_alias
11
+ from pygmt .params import Box
11
12
12
13
__doctest_skip__ = ["inset" ]
13
14
14
15
15
16
@fmt_docstring
16
17
@contextlib .contextmanager
17
- @use_alias (
18
- D = "position" ,
19
- F = "box" ,
20
- M = "margin" ,
21
- N = "no_clip" ,
22
- R = "region" ,
23
- )
18
+ @use_alias (D = "position" , M = "margin" , N = "no_clip" , R = "region" )
24
19
@kwargs_to_strings (D = "sequence" , M = "sequence" , R = "sequence" )
25
20
def inset (
26
21
self ,
27
22
projection = None ,
23
+ box : Box | bool = False ,
28
24
verbose : Literal ["quiet" , "error" , "warning" , "timing" , "info" , "compat" , "debug" ]
29
25
| bool = False ,
30
26
** kwargs ,
@@ -39,6 +35,7 @@ def inset(
39
35
Full GMT docs at :gmt-docs:`inset.html`.
40
36
41
37
{aliases}
38
+ - F = box
42
39
- J = projection
43
40
- V = verbose
44
41
@@ -83,27 +80,11 @@ def inset(
83
80
as *refpoint*, if **J** is used then *justify* defaults to the
84
81
mirror opposite of *refpoint*. Specify inset box attributes via
85
82
the ``box`` parameter [Default is outline only].
86
- box : str or bool
87
- [**+c**\ *clearances*][**+g**\ *fill*][**+i**\ [[*gap*/]\
88
- *pen*]][**+p**\ [*pen*]][**+r**\ [*radius*]][**+s**\
89
- [[*dx*/*dy*/][*shade*]]].
90
- If set to ``True``, draw a rectangular box around the map
91
- inset using the default pen; specify a different pen
92
- with **+p**\ *pen*. Add **+g**\ *fill* to fill the inset box
93
- [Default is no fill].
94
- Append **+c**\ *clearance* where *clearance* is either
95
- *gap*, *xgap*\ /\ *ygap*, or *lgap*\ /\ *rgap*\ /\ *bgap*\ /\
96
- *tgap* where these items are uniform, separate in x- and
97
- y-directions, or individual side spacings between map embellishment
98
- and border. Append **+i** to draw a secondary, inner border as well.
99
- We use a uniform *gap* between borders of 2p and the default pen
100
- unless other values are specified. Append **+r** to draw rounded
101
- rectangular borders instead, with a 6p corner radius. You
102
- can override this radius by appending another value. Append
103
- **+s** to draw an offset background shaded region. Here, *dx*/*dy*
104
- indicates the shift relative to the foreground frame [Default is
105
- ``"4p/-4p"``] and *shade* sets the fill style to use for
106
- shading [Default is ``"gray50"``].
83
+ box
84
+ Draw a background box behind the inset. If set to ``True``, a simple rectangular
85
+ box is drawn using :gmt-term:`MAP_FRAME_PEN`. To customize the box appearance,
86
+ pass a :class:`pygmt.params.Box` object to control style, fill, pen, and other
87
+ box properties.
107
88
margin : float, str, or list
108
89
This is clearance that is added around the inside of the inset.
109
90
Plotting will take place within the inner region only. The margins
@@ -147,7 +128,9 @@ def inset(
147
128
"""
148
129
self ._activate_figure ()
149
130
150
- aliasdict = AliasSystem ().add_common (
131
+ aliasdict = AliasSystem (
132
+ F = Alias (box , name = "box" ),
133
+ ).add_common (
151
134
J = projection ,
152
135
V = verbose ,
153
136
)
0 commit comments