Skip to content

Commit

Permalink
duplicate the level if a single level was passed
Browse files Browse the repository at this point in the history
  • Loading branch information
keewis committed Mar 6, 2021
1 parent 37522e9 commit 9d1c3cb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions xarray/plot/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ def _build_discrete_cmap(cmap, levels, extend, filled):
"""
import matplotlib as mpl

if isinstance(levels, (int, float)):
levels = [levels, levels]
elif len(levels) == 1:
levels = [levels[0], levels[0]]

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

0 comments on commit 9d1c3cb

Please sign in to comment.