Skip to content

Commit e90c9cd

Browse files
Figure.set_panel: Deprecate parameter 'fixedlabel' to 'tag' (Will be removed in v0.23.0) (#4393)
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
1 parent f97dce9 commit e90c9cd

2 files changed

Lines changed: 20 additions & 15 deletions

File tree

examples/tutorials/advanced/subplots.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@
229229

230230
# %%
231231
# You can also manually override the ``tag`` for each subplot using for example,
232-
# ``fig.set_panel(..., fixedlabel="b) Panel 2")`` which would allow you to manually tag
233-
# a single subplot as you wish. This can be useful for adding a more descriptive
234-
# subtitle to individual subplots.
232+
# ``fig.set_panel(..., tag="b) Panel 2")`` which would allow you to manually tag a
233+
# single subplot as you wish. This can be useful for adding a more descriptive subtitle
234+
# to individual subplots.
235235

236236
# sphinx_gallery_thumbnail_number = 3

pygmt/src/subplot.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@
1010
from pygmt.alias import Alias, AliasSystem
1111
from pygmt.clib import Session
1212
from pygmt.exceptions import GMTParameterError, GMTValueError
13-
from pygmt.helpers import build_arg_list, fmt_docstring, kwargs_to_strings, use_alias
13+
from pygmt.helpers import (
14+
build_arg_list,
15+
deprecate_parameter,
16+
fmt_docstring,
17+
kwargs_to_strings,
18+
use_alias,
19+
)
1420
from pygmt.params import Box, Position
1521
from pygmt.src._common import _parse_position
1622

@@ -352,10 +358,13 @@ def subplot( # noqa: PLR0913
352358

353359
@fmt_docstring
354360
@contextlib.contextmanager
355-
@use_alias(A="fixedlabel", C="clearance")
361+
# TODO(PyGMT>=0.23.0): Remove the deprecated 'fixedlabel' parameter.
362+
@deprecate_parameter("fixedlabel", "tag", "v0.19.0", remove_version="v0.23.0")
363+
@use_alias(C="clearance")
356364
def set_panel(
357365
self,
358366
panel: int | Sequence[int] | None = None,
367+
tag: str | None = None,
359368
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
360369
| bool = False,
361370
**kwargs,
@@ -372,6 +381,7 @@ def set_panel(
372381
``projection="X"`` will fill the subplot by using unequal scales].
373382
374383
$aliases
384+
- A = tag
375385
- V = verbose
376386
377387
Parameters
@@ -386,13 +396,10 @@ def set_panel(
386396
GMT maintains information about the current figure and subplot. Also, you may
387397
give the one-dimensional *index* instead which starts at 0 and follows the row
388398
or column order set via ``autolabel`` in :meth:`pygmt.Figure.subplot`.
389-
390-
fixedlabel : str
391-
Overrides the automatic labeling with the given string. No modifiers
392-
are allowed. Placement, justification, etc. are all inherited from how
393-
``autolabel`` was specified by the initial :meth:`pygmt.Figure.subplot`
394-
command.
395-
399+
tag
400+
Tag for the current subplot. It overrides the automatic tag set by the
401+
:meth:`pygmt.Figure.subplot` method. Use ``tag="-"`` to skip the tag for this
402+
panel.
396403
clearance : str or list
397404
[*side*]\ *clearance*.
398405
Reserve a space of dimension *clearance* between the margin and the
@@ -409,9 +416,7 @@ def set_panel(
409416
"""
410417
self._activate_figure()
411418

412-
aliasdict = AliasSystem().add_common(
413-
V=verbose,
414-
)
419+
aliasdict = AliasSystem(A=Alias(tag, name="tag")).add_common(V=verbose)
415420
aliasdict.merge(kwargs)
416421

417422
with Session() as lib:

0 commit comments

Comments
 (0)