From dae02a30be3b29e272e4afe645128f4a80a81178 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Fri, 4 Sep 2026 15:29:53 +0800 Subject: [PATCH 1/3] Figure.image: Fix docstring for bgcolor/fgcolor and raise exception before warning for bitcolor --- pygmt/src/image.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pygmt/src/image.py b/pygmt/src/image.py index 91e927dde09..7b6d5cbf46c 100644 --- a/pygmt/src/image.py +++ b/pygmt/src/image.py @@ -118,8 +118,8 @@ def image( box properties. bgcolor fgcolor - For 1-bit images, set the background and foreground colors [Default is black and - white, respectively]. Setting either to an empty string makes those pixels + For 1-bit images, set the background and foreground colors [Default is the + image's own colors]. Setting either to an empty string makes those pixels transparent. Cannot be both empty. transparent_color For color images, set a single color that should be made transparent. @@ -165,12 +165,6 @@ def image( # TODO(PyGMT>=0.24.0): Remove the deprecated "bitcolor" parameter. if bitcolor is not None: - msg = ( - "The 'bitcolor' parameter has been deprecated since v0.20.0 and will be " - "removed in v0.24.0. Use 'bgcolor', 'fgcolor' or 'transparent_color' " - "instead." - ) - warnings.warn(msg, category=FutureWarning, stacklevel=2) if any(v is not None for v in [bgcolor, fgcolor, transparent_color]): raise GMTParameterError( conflicts_with=( @@ -178,6 +172,12 @@ def image( ["bgcolor", "fgcolor", "transparent_color"], ), ) + msg = ( + "The 'bitcolor' parameter has been deprecated since v0.20.0 and will be " + "removed in v0.24.0. Use 'bgcolor', 'fgcolor' or 'transparent_color' " + "instead." + ) + warnings.warn(msg, category=FutureWarning, stacklevel=2) # 'bgcolor' and 'fgcolor' cannot both be empty. if bgcolor == "" and fgcolor == "": From 8532d6f5959acc15a51055e5914e79cc9c8011de Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Fri, 4 Sep 2026 15:54:54 +0800 Subject: [PATCH 2/3] Update the test --- pygmt/tests/test_image.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/pygmt/tests/test_image.py b/pygmt/tests/test_image.py index b762d12f23d..a62281f85f2 100644 --- a/pygmt/tests/test_image.py +++ b/pygmt/tests/test_image.py @@ -145,13 +145,8 @@ def test_image_bitcolor_conflict(): """ fig = Figure() with pytest.raises(GMTParameterError): - with pytest.warns(FutureWarning): - fig.image(imagefile="@circuit.png", bitcolor="red+b", bgcolor="blue") + fig.image(imagefile="@circuit.png", bitcolor="red+b", bgcolor="blue") with pytest.raises(GMTParameterError): - with pytest.warns(FutureWarning): - fig.image(imagefile="@circuit.png", bitcolor="red+b", fgcolor="blue") + fig.image(imagefile="@circuit.png", bitcolor="red+b", fgcolor="blue") with pytest.raises(GMTParameterError): - with pytest.warns(FutureWarning): - fig.image( - imagefile="@circuit.png", bitcolor="red+b", transparent_color="blue" - ) + fig.image(imagefile="@circuit.png", bitcolor="red+b", transparent_color="blue") From 087a6b02408234e77149a50f10a04200f716b324 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Fri, 4 Sep 2026 16:55:08 +0800 Subject: [PATCH 3/3] Fix version string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com> --- pygmt/src/image.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pygmt/src/image.py b/pygmt/src/image.py index 7b6d5cbf46c..269b7e019aa 100644 --- a/pygmt/src/image.py +++ b/pygmt/src/image.py @@ -173,8 +173,8 @@ def image( ), ) msg = ( - "The 'bitcolor' parameter has been deprecated since v0.20.0 and will be " - "removed in v0.24.0. Use 'bgcolor', 'fgcolor' or 'transparent_color' " + "The 'bitcolor' parameter has been deprecated since 0.20.0 and will be " + "removed in 0.24.0. Use 'bgcolor', 'fgcolor' or 'transparent_color' " "instead." ) warnings.warn(msg, category=FutureWarning, stacklevel=2)