@@ -1101,6 +1101,8 @@ def _process_values(self):
11011101 elif isinstance (self .norm , colors .NoNorm ):
11021102 # NoNorm has N blocks, so N+1 boundaries, centered on integers:
11031103 b = np .arange (self .cmap .N + 1 ) - .5
1104+ elif self .boundaries is not None :
1105+ b = self .boundaries
11041106 else :
11051107 # otherwise make the boundaries from the size of the cmap:
11061108 N = self .cmap .N + 1
@@ -1117,7 +1119,8 @@ def _process_values(self):
11171119 self .norm .vmax = 1
11181120 self .norm .vmin , self .norm .vmax = mtransforms .nonsingular (
11191121 self .norm .vmin , self .norm .vmax , expander = 0.1 )
1120- if not isinstance (self .norm , colors .BoundaryNorm ):
1122+ if (not isinstance (self .norm , colors .BoundaryNorm ) and
1123+ (self .boundaries is None )):
11211124 b = self .norm .inverse (b )
11221125
11231126 self ._boundaries = np .asarray (b , dtype = float )
@@ -1141,7 +1144,8 @@ def _mesh(self):
11411144 norm .vmax = self .vmax
11421145 y , extendlen = self ._proportional_y ()
11431146 # invert:
1144- if isinstance (norm , (colors .BoundaryNorm , colors .NoNorm )):
1147+ if (isinstance (norm , (colors .BoundaryNorm , colors .NoNorm )) or
1148+ self .boundaries is not None ):
11451149 y = y * (self .vmax - self .vmin ) + self .vmin # not using a norm.
11461150 else :
11471151 y = norm .inverse (y )
@@ -1237,7 +1241,8 @@ def _proportional_y(self):
12371241 Return colorbar data coordinates for the boundaries of
12381242 a proportional colorbar, plus extension lengths if required:
12391243 """
1240- if isinstance (self .norm , colors .BoundaryNorm ):
1244+ if (isinstance (self .norm , colors .BoundaryNorm ) or
1245+ self .boundaries is not None ):
12411246 y = (self ._boundaries - self ._boundaries [self ._inside ][0 ])
12421247 y = y / (self ._boundaries [self ._inside ][- 1 ] -
12431248 self ._boundaries [self ._inside ][0 ])
0 commit comments