Skip to content

Commit 163b71f

Browse files
authored
Merge branch 'main' into refactor/legend
2 parents 7ce59a9 + 74b3cf7 commit 163b71f

2 files changed

Lines changed: 17 additions & 10 deletions

File tree

pygmt/src/_common.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def _parse_position(
251251
position: Position | Sequence[float | str] | str | None,
252252
kwdict: dict[str, Any],
253253
default: Position | None,
254-
) -> Position | str:
254+
) -> Position | str | None:
255255
"""
256256
Parse the "position" parameter for embellishment-plotting functions.
257257
@@ -260,16 +260,17 @@ def _parse_position(
260260
position
261261
The position argument to parse. It can be one of the following:
262262
263-
- A :class:`pygmt.params.Position` object.
264-
- A sequence of two values representing x and y coordinates in plot coordinates.
265-
- A 2-character justification code.
266-
- A raw GMT command string (for backward compatibility).
267-
- ``None``, in which case the default position is used.
263+
- A :class:`pygmt.params.Position` object
264+
- A sequence of two values representing x- and y-coordinates in plot coordinates
265+
- A 2-character justification code
266+
- A raw GMT command string (for backward compatibility)
267+
- ``None``, in which case the default position is used
268268
kwdict
269269
The keyword arguments dictionary that conflicts with ``position`` if
270270
``position`` is given as a raw GMT command string.
271271
default
272-
The default Position object to use if ``position`` is ``None``.
272+
The default Position object to use if ``position`` is ``None``. If ``default``
273+
is ``None``, use the GMT default.
273274
274275
Returns
275276
-------
@@ -306,6 +307,12 @@ def _parse_position(
306307
... )
307308
Position(refpoint=(0, 0), cstype='plotcoords')
308309
310+
>>> _parse_position(
311+
... None,
312+
... kwdict={"width": None, "height": None},
313+
... default=None,
314+
... )
315+
309316
>>> _parse_position(
310317
... "x3c/4c+w2c",
311318
... kwdict={"width": None, "height": None},
@@ -349,7 +356,7 @@ def _parse_position(
349356
position = Position(position, cstype="plotcoords")
350357
case Position(): # Already a Position object.
351358
pass
352-
case None if default is not None: # Set default position.
359+
case None: # Set default position.
353360
position = default
354361
case _:
355362
msg = f"Invalid type for parameter 'position': {type(position)}."

pygmt/src/logo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ def logo( # noqa: PLR0913
6666
6767
- A :class:`pygmt.params.Position` object to fully control the reference point,
6868
anchor point, and offset.
69-
- A sequence of two values representing the x and y coordinates in plot
69+
- A sequence of two values representing the x- and y- coordinates in plot
7070
coordinates, e.g., ``(1, 2)`` or ``("1c", "2c")``.
7171
- A :doc:`2-character justification code </techref/justification_codes>` for a
7272
position inside the plot, e.g., ``"TL"`` for Top Left corner inside the plot.
7373
74-
If not specified, defaults to the lower-left corner of the plot (position
74+
If not specified, defaults to the Bottom Left corner of the plot (position
7575
``(0, 0)`` with anchor ``"BL"``).
7676
width
7777
height

0 commit comments

Comments
 (0)