Skip to content

Commit 9d1c3cb

Browse files
committed
duplicate the level if a single level was passed
1 parent 37522e9 commit 9d1c3cb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

xarray/plot/utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ def _build_discrete_cmap(cmap, levels, extend, filled):
6060
"""
6161
import matplotlib as mpl
6262

63+
if isinstance(levels, (int, float)):
64+
levels = [levels, levels]
65+
elif len(levels) == 1:
66+
levels = [levels[0], levels[0]]
67+
6368
if not filled:
6469
# non-filled contour plots
6570
extend = "max"

0 commit comments

Comments
 (0)