Skip to content
forked from pydata/xarray

Commit

Permalink
fix matplotlib errors for single level discrete colormaps (pydata#4256)
Browse files Browse the repository at this point in the history
* duplicate the level if a single level was passed

* don't handle scalars

it seems these will never be passed at that level

* [test-upstream] [skip-ci]
  • Loading branch information
keewis committed Mar 7, 2021
1 parent b610a3c commit 54d5817
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions xarray/plot/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ def _build_discrete_cmap(cmap, levels, extend, filled):
"""
import matplotlib as mpl

if len(levels) == 1:
levels = [levels[0], levels[0]]

if not filled:
# non-filled contour plots
extend = "max"
Expand Down

0 comments on commit 54d5817

Please sign in to comment.