@@ -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 )} ."
0 commit comments