Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Figure.wiggle: Remove deprecated parameter 'color', use fillpositive/fillnegative instead (deprecated since v0.8.0) #3035

Merged
merged 6 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
13 changes: 0 additions & 13 deletions pygmt/src/wiggle.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
"""
wiggle - Plot z=f(x,y) anomalies along tracks.
"""
import warnings
michaelgrund marked this conversation as resolved.
Show resolved Hide resolved

from pygmt.clib import Session
from pygmt.exceptions import GMTInvalidInput
from pygmt.helpers import build_arg_string, fmt_docstring, kwargs_to_strings, use_alias


Expand Down Expand Up @@ -102,17 +100,6 @@ def wiggle(
"""
kwargs = self._preprocess(**kwargs)

if (fillpositive or fillnegative) and kwargs.get("G") is not None:
raise GMTInvalidInput("Use either fillpositive/fillnegative or color.")

if kwargs.get("G") is not None:
msg = (
"The 'color' parameter has been deprecated since v0.8.0"
" and will be removed in v0.12.0. Use fillpositive/fillnegative"
" instead."
)
warnings.warn(msg, category=FutureWarning, stacklevel=2)

if fillpositive or fillnegative:
kwargs["G"] = []
if fillpositive:
Expand Down
55 changes: 0 additions & 55 deletions pygmt/tests/test_wiggle.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import numpy as np
import pytest
from pygmt import Figure
from pygmt.exceptions import GMTInvalidInput


@pytest.mark.mpl_image_compare
Expand Down Expand Up @@ -61,57 +60,3 @@ def test_wiggle_data_incols():
position="jRM+w2+lnT",
)
return fig


def test_wiggle_fill_multiple():
"""
Check that wiggle fails when the parameters color and fillpositive/fillnegative are
used together.
"""
x = np.arange(-2, 2, 0.02)
y = np.zeros(x.size)
z = np.cos(2 * np.pi * x)

fig = Figure()
with pytest.raises(GMTInvalidInput):
fig.wiggle(
x=x,
y=y,
z=z,
region=[-4, 4, -1, 1],
projection="X8c",
incols=[1, 0, 2],
scale="0.5c",
color="blue",
fillpositive="red",
fillnegative="gray",
pen="1.0p",
track="0.5p",
position="jRM+w2+lnT",
)


def test_wiggle_use_color():
"""
Check that wiggle raises a warning when the deprecated parameter color is used.
"""
x = np.arange(-2, 2, 0.02)
y = np.zeros(x.size)
z = np.cos(2 * np.pi * x)

fig = Figure()
with pytest.warns(expected_warning=FutureWarning) as record:
fig.wiggle(
x=x,
y=y,
z=z,
region=[-4, 4, -1, 1],
projection="X8c",
incols=[1, 0, 2],
scale="0.5c",
color="blue",
pen="1.0p",
track="0.5p",
position="jRM+w2+lnT",
)
assert len(record) == 1
Loading