From fae4c064749d713addeb8af8c31840d3bec63751 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Fri, 12 Dec 2025 14:41:59 +0100 Subject: [PATCH 1/6] Deprecate compressionfill and extensionfill to compression_fill and extension_fill --- pygmt/src/meca.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pygmt/src/meca.py b/pygmt/src/meca.py index b9f9c956aa4..06dc408f3b4 100644 --- a/pygmt/src/meca.py +++ b/pygmt/src/meca.py @@ -13,6 +13,7 @@ from pygmt.exceptions import GMTInvalidInput, GMTValueError from pygmt.helpers import ( build_arg_list, + deprecate_parameter, data_kind, fmt_docstring, use_alias, @@ -115,12 +116,14 @@ def _auto_offset(spec) -> bool: @fmt_docstring +@deprecate_parameter("extensionfill", "extension_fill", "v0.18.0", remove_version="v0.20.0") +@deprecate_parameter("compressionfill", "compression_fill", "v0.18.0", remove_version="v0.20.0") @use_alias( A="offset", C="cmap", - E="extensionfill", + E="extension_fill", Fr="labelbox", - G="compressionfill", + G="compression_fill", L="outline", T="nodal", W="pen", @@ -302,12 +305,12 @@ def meca( # noqa: PLR0913 is drawn. Use **+s**\ *size* to plot a small circle at the initial location and to set the diameter of this circle [Default is no circle]. Use **+p**\ *pen* to set the pen attributes for this feature [Default is set via ``pen``]. The fill - of the circle is set via ``compressionfill`` or ``cmap``, i.e., corresponds to + of the circle is set via ``compression_fill`` or ``cmap``, i.e., corresponds to the fill of the compressive quadrants. - compressionfill : str + compression_fill : str Set color or pattern for filling compressive quadrants [Default is ``"black"``]. This setting also applies to the fill of the circle defined via ``offset``. - extensionfill : str + extension_fill : str Set color or pattern for filling extensive quadrants [Default is ``"white"``]. pen : str Set (default) pen attributes for all lines related to the beachball [Default is From ef5aa00cf0077bb0f73143b33391c5efe9083c93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Fri, 12 Dec 2025 14:42:31 +0100 Subject: [PATCH 2/6] Update gallery example --- examples/gallery/seismology/meca.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/gallery/seismology/meca.py b/examples/gallery/seismology/meca.py index 16b2ff3ec7f..748e73edf4e 100644 --- a/examples/gallery/seismology/meca.py +++ b/examples/gallery/seismology/meca.py @@ -7,8 +7,8 @@ as a dictionary using the ``spec`` parameter (or they can be specified as a 1-D or 2-D array, or within a file). The size of the beachballs can be set using the ``scale`` parameter. The compressive and extensive quadrants can -be filled either with a color or a pattern via the ``compressionfill`` and -``extensionfill`` parameters, respectively. Use the ``pen`` parameter to +be filled either with a color or a pattern via the ``compression_fill`` and +``extension_fill`` parameters, respectively. Use the ``pen`` parameter to adjust the outline of the beachballs. """ @@ -41,10 +41,10 @@ depth=12.0, # Fill compressive quadrants with color "red" # [Default is "black"] - compressionfill="red", + compression_fill="red", # Fill extensive quadrants with color "cornsilk" # [Default is "white"] - extensionfill="cornsilk", + extension_fill="cornsilk", # Draw a 0.5-point thick dark gray ("gray30") solid outline via # the pen parameter [Default is "0.25p,black,solid"] pen="0.5p,gray30,solid", From d7ab0ae568f8355307d5e92808157ea5f5b92dcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Fri, 12 Dec 2025 14:43:10 +0100 Subject: [PATCH 3/6] Update tutorial --- .../tutorials/advanced/focal_mechanisms.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/tutorials/advanced/focal_mechanisms.py b/examples/tutorials/advanced/focal_mechanisms.py index c9ba743e904..c3c672453e5 100644 --- a/examples/tutorials/advanced/focal_mechanisms.py +++ b/examples/tutorials/advanced/focal_mechanisms.py @@ -99,7 +99,7 @@ # Filling the quadrants # --------------------- # -# Use the parameters ``compressionfill`` and ``extensionfill`` to fill the quadrants +# Use the parameters ``compression_fill`` and ``extension_fill`` to fill the quadrants # with different colors or :class:`patterns `. fig = pygmt.Figure() fig.basemap(region=region, projection=projection, frame=frame) @@ -110,8 +110,8 @@ longitude=-2, latitude=0, depth=0, - compressionfill="darkorange", - extensionfill="cornsilk", + compression_fill="darkorange", + extension_fill="cornsilk", ) fig.meca( @@ -120,8 +120,8 @@ longitude=2, latitude=0, depth=0, - compressionfill=Pattern(8), - extensionfill=Pattern(31), + compression_fill=Pattern(8), + extension_fill=Pattern(31), outline=True, ) @@ -168,8 +168,8 @@ # both, ``"1"`` to the first, and ``"2"`` to the second nodal plane(s). Only the # circumference and the specified nodal plane(s) are plotted, i.e. the quadrants # remain unfilled (transparent). We can make use of the stacking concept of (Py)GMT, -# and use ``nodal`` in combination with the ``outline``, ``compressionfill`` / -# ``extensionfill`` and ``pen`` parameters. +# and use ``nodal`` in combination with the ``outline``, ``compression_fill`` / +# ``extension_fill`` and ``pen`` parameters. fig = pygmt.Figure() fig.basemap(region=region, projection=projection, frame=frame) @@ -188,9 +188,9 @@ # (ii) Plot the first nodal plane and the circumference in darkorange # (iii) Plot the circumfence in black on top; use "-" to not fill the quadrants for kwargs in [ - {"compressionfill": "lightorange"}, + {"compression_fill": "lightorange"}, {"nodal": "1/1p,darkorange"}, - {"compressionfill": "-", "extensionfill": "-", "pen": "1p,gray30"}, + {"compression_fill": "-", "extension_fill": "-", "pen": "1p,gray30"}, ]: fig.meca( spec=aki_single, @@ -238,7 +238,7 @@ plot_longitude=1, plot_latitude=2, offset="+p1p,darkorange+s0.25c", - compressionfill="lightorange", + compression_fill="lightorange", ) fig.show() From cb9d5cf219970931cd64eee488b4fdf891f2d08b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Fri, 12 Dec 2025 15:16:15 +0100 Subject: [PATCH 4/6] Update pattern example --- examples/gallery/symbols/patterns.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/gallery/symbols/patterns.py b/examples/gallery/symbols/patterns.py index f9896a9ee47..1cb9cca0dbf 100644 --- a/examples/gallery/symbols/patterns.py +++ b/examples/gallery/symbols/patterns.py @@ -9,8 +9,8 @@ - :meth:`pygmt.Figure.coast`: Land and water masses via ``land`` and ``water`` - :meth:`pygmt.Figure.histogram`: Histogram bars via ``fill`` -- :meth:`pygmt.Figure.meca`: Focal mechanisms via ``compressionfill`` and - ``extensionfill`` +- :meth:`pygmt.Figure.meca`: Focal mechanisms via ``compression_fill`` and + ``extension_fill`` - :meth:`pygmt.Figure.plot`: Symbols and polygons via ``fill`` - :meth:`pygmt.Figure.rose`: Histogram sectors via ``fill`` - :meth:`pygmt.Figure.solar`: Day-light terminators via ``fill`` From 524a4d3f23308ae7809fbff1ec6956309b18b668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Fri, 12 Dec 2025 16:33:05 +0100 Subject: [PATCH 5/6] Fix coding style --- pygmt/src/meca.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pygmt/src/meca.py b/pygmt/src/meca.py index 06dc408f3b4..2315d76b3e5 100644 --- a/pygmt/src/meca.py +++ b/pygmt/src/meca.py @@ -13,8 +13,8 @@ from pygmt.exceptions import GMTInvalidInput, GMTValueError from pygmt.helpers import ( build_arg_list, - deprecate_parameter, data_kind, + deprecate_parameter, fmt_docstring, use_alias, ) @@ -116,8 +116,12 @@ def _auto_offset(spec) -> bool: @fmt_docstring -@deprecate_parameter("extensionfill", "extension_fill", "v0.18.0", remove_version="v0.20.0") -@deprecate_parameter("compressionfill", "compression_fill", "v0.18.0", remove_version="v0.20.0") +@deprecate_parameter( + "extensionfill", "extension_fill", "v0.18.0", remove_version="v0.20.0" +) +@deprecate_parameter( + "compressionfill", "compression_fill", "v0.18.0", remove_version="v0.20.0" +) @use_alias( A="offset", C="cmap", From d98c9d78fb24eb3a86e0e098e541f118ad248420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Fri, 12 Dec 2025 20:45:43 +0100 Subject: [PATCH 6/6] Use maximum line length --- examples/gallery/seismology/meca.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/examples/gallery/seismology/meca.py b/examples/gallery/seismology/meca.py index 748e73edf4e..d85be82586e 100644 --- a/examples/gallery/seismology/meca.py +++ b/examples/gallery/seismology/meca.py @@ -2,14 +2,13 @@ Focal mechanisms ================ -The :meth:`pygmt.Figure.meca` method can plot focal mechanisms or beachballs. -We can specify the focal mechanism nodal planes or moment tensor components -as a dictionary using the ``spec`` parameter (or they can be specified as a -1-D or 2-D array, or within a file). The size of the beachballs can be set -using the ``scale`` parameter. The compressive and extensive quadrants can -be filled either with a color or a pattern via the ``compression_fill`` and -``extension_fill`` parameters, respectively. Use the ``pen`` parameter to -adjust the outline of the beachballs. +The :meth:`pygmt.Figure.meca` method can plot focal mechanisms or beachballs. We can +specify the focal mechanism nodal planes or moment tensor components as a dictionary +using the ``spec`` parameter (or they can be specified as a 1-D or 2-D array, or within +a file). The size of the beachballs can be set using the ``scale`` parameter. The +compressive and extensive quadrants can be filled either with a color or a pattern via +the ``compression_fill`` and ``extension_fill`` parameters, respectively. Use the +``pen`` parameter to adjust the outline of the beachballs. """ # %%