55import contextlib
66from typing import Literal
77
8- from pygmt .alias import AliasSystem
8+ from pygmt .alias import Alias , AliasSystem
99from pygmt .clib import Session
1010from pygmt .helpers import build_arg_list , fmt_docstring , kwargs_to_strings , use_alias
11+ from pygmt .params import Box
1112
1213__doctest_skip__ = ["inset" ]
1314
1415
1516@fmt_docstring
1617@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" )
2419@kwargs_to_strings (D = "sequence" , M = "sequence" , R = "sequence" )
2520def inset (
2621 self ,
2722 projection = None ,
23+ box : Box | bool = False ,
2824 verbose : Literal ["quiet" , "error" , "warning" , "timing" , "info" , "compat" , "debug" ]
2925 | bool = False ,
3026 ** kwargs ,
@@ -39,6 +35,7 @@ def inset(
3935 Full GMT docs at :gmt-docs:`inset.html`.
4036
4137 {aliases}
38+ - F = box
4239 - J = projection
4340 - V = verbose
4441
@@ -83,27 +80,11 @@ def inset(
8380 as *refpoint*, if **J** is used then *justify* defaults to the
8481 mirror opposite of *refpoint*. Specify inset box attributes via
8582 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.
10788 margin : float, str, or list
10889 This is clearance that is added around the inside of the inset.
10990 Plotting will take place within the inner region only. The margins
@@ -147,7 +128,9 @@ def inset(
147128 """
148129 self ._activate_figure ()
149130
150- aliasdict = AliasSystem ().add_common (
131+ aliasdict = AliasSystem (
132+ F = Alias (box , name = "box" ),
133+ ).add_common (
151134 J = projection ,
152135 V = verbose ,
153136 )
0 commit comments