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

Raise error if cmap is list of colors #3310

Merged
merged 2 commits into from
Sep 17, 2019
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
2 changes: 2 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ Breaking changes
- :py:func:`~xarray.concat` now requires the ``dim`` argument. Its ``indexers``, ``mode``
and ``concat_over`` kwargs have now been removed.
By `Deepak Cherian <https://github.com/dcherian>`_
- Passing a list of colors in ``cmap`` will now raise an error, having been deprecated since
v0.6.1.
- Most xarray objects now define ``__slots__``. This reduces overall RAM usage by ~22%
(not counting the underlying numpy buffers); on CPython 3.7/x64, a trivial DataArray
has gone down from 1.9kB to 1.5kB.
Expand Down
6 changes: 2 additions & 4 deletions xarray/plot/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,11 +737,9 @@ def _process_cmap_cbar_kwargs(
# we should not be getting a list of colors in cmap anymore
# is there a better way to do this test?
if isinstance(cmap, (list, tuple)):
warnings.warn(
raise ValueError(
"Specifying a list of colors in cmap is deprecated. "
"Use colors keyword instead.",
DeprecationWarning,
stacklevel=3,
"Use colors keyword instead."
)

cmap_kwargs = {
Expand Down
4 changes: 2 additions & 2 deletions xarray/tests/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1320,8 +1320,8 @@ def test_cmap_and_color_both(self):
with pytest.raises(ValueError):
self.plotmethod(colors="k", cmap="RdBu")

def list_of_colors_in_cmap_deprecated(self):
with pytest.raises(Exception):
def list_of_colors_in_cmap_raises_error(self):
with raises_regex(ValueError, "list of colors"):
self.plotmethod(cmap=["k", "b"])

@pytest.mark.slow
Expand Down