Skip to content

Commit b50b4eb

Browse files
authored
Figure.set_panel: Migrate the 'panel' parameter to the new alias system (#4175)
1 parent 57c96db commit b50b4eb

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

pygmt/src/subplot.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,9 @@ def subplot(
203203
@fmt_docstring
204204
@contextlib.contextmanager
205205
@use_alias(A="fixedlabel", C="clearance")
206-
@kwargs_to_strings(panel="sequence_comma")
207206
def set_panel(
208207
self,
209-
panel=None,
208+
panel: int | Sequence[int] | None = None,
210209
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
211210
| bool = False,
212211
**kwargs,
@@ -227,17 +226,16 @@ def set_panel(
227226
228227
Parameters
229228
----------
230-
panel : str or list
231-
*row,col*\|\ *index*.
232-
Sets the current subplot until further notice. **Note**: First *row*
233-
or *col* is 0, not 1. If not given we go to the next subplot by order
234-
specified via ``autolabel`` in :meth:`pygmt.Figure.subplot`. As an
235-
alternative, you may bypass using :meth:`pygmt.Figure.set_panel` and
236-
instead supply the common option **panel**\ =[*row,col*] to the first
237-
plot command you issue in that subplot. GMT maintains information about
238-
the current figure and subplot. Also, you may give the one-dimensional
239-
*index* instead which starts at 0 and follows the row or column order
240-
set via ``autolabel`` in :meth:`pygmt.Figure.subplot`.
229+
panel
230+
*index* or (*row*, *col*).
231+
Sets the current subplot until further notice. **Note**: First *row* or *col* is
232+
0, not 1. If not given we go to the next subplot by order specified via
233+
``autolabel`` in :meth:`pygmt.Figure.subplot`. As an alternative, you may bypass
234+
using :meth:`pygmt.Figure.set_panel` and instead supply the common option
235+
**panel**=(*row*, *col*) to the first plot command you issue in that subplot.
236+
GMT maintains information about the current figure and subplot. Also, you may
237+
give the one-dimensional *index* instead which starts at 0 and follows the row
238+
or column order set via ``autolabel`` in :meth:`pygmt.Figure.subplot`.
241239
242240
fixedlabel : str
243241
Overrides the automatic labeling with the given string. No modifiers
@@ -268,6 +266,11 @@ def set_panel(
268266

269267
with Session() as lib:
270268
lib.call_module(
271-
module="subplot", args=["set", str(panel), *build_arg_list(aliasdict)]
269+
module="subplot",
270+
args=[
271+
"set",
272+
Alias(panel, name="panel", sep=",", size=2)._value,
273+
*build_arg_list(aliasdict),
274+
],
272275
)
273276
yield

0 commit comments

Comments
 (0)