@@ -2500,7 +2500,7 @@ def _parse_level_num(
25002500 Unused arguments.
25012501 """
25022502 # Input args
2503- # NOTE: Some of this is adapted from the hidden contour.ContourSet._autolev
2503+ # NOTE: Some of this is adapted from contour.ContourSet._autolev
25042504 # NOTE: We use 'symmetric' with MaxNLocator to ensure boundaries
25052505 # include a zero level but may trim many of these levels below.
25062506 norm_kw = norm_kw or {}
@@ -2551,7 +2551,7 @@ def _parse_level_num(
25512551 vmin , vmax , levels = vmin + vcenter , vmax + vcenter , levels + vcenter
25522552
25532553 # Possibly trim levels far outside of 'vmin' and 'vmax'
2554- # NOTE: This part is mostly copied from contour.ContourSet. _autolev
2554+ # NOTE: This part is mostly copied from matplotlib _autolev
25552555 if not symmetric :
25562556 i0 , i1 = 0 , len (levels ) # defaults
25572557 under , = np .where (levels < vmin )
@@ -2832,7 +2832,11 @@ def _parse_level_norm(
28322832
28332833 # Generate DiscreteNorm and update "child" norm with vmin and vmax from
28342834 # levels. This lets the colorbar set tick locations properly!
2835- if not isinstance (norm , mcolors .BoundaryNorm ) and len (levels ) > 1 :
2835+ if len (levels ) == 1 :
2836+ pass # e.g. contours
2837+ elif isinstance (norm , mcolors .BoundaryNorm ):
2838+ pass # override with native matplotlib normalizer
2839+ else :
28362840 norm = pcolors .DiscreteNorm (
28372841 levels , norm = norm , unique = unique , step = step ,
28382842 ticks = discrete_ticks , labels = discrete_labels ,
0 commit comments