Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions pygmt/src/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -165,19 +165,19 @@ 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=(
"bitcolor",
["bgcolor", "fgcolor", "transparent_color"],
),
)
msg = (
"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."
)
Comment thread
seisman marked this conversation as resolved.
warnings.warn(msg, category=FutureWarning, stacklevel=2)

# 'bgcolor' and 'fgcolor' cannot both be empty.
if bgcolor == "" and fgcolor == "":
Expand Down
11 changes: 3 additions & 8 deletions pygmt/tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Loading