@@ -231,7 +231,7 @@ def draw(self, renderer):
231
231
232
232
class _ColorbarAxesLocator :
233
233
"""
234
- Shrink the axes if there are vertical extends .
234
+ Shrink the axes if there are extend triangles or rectangles .
235
235
"""
236
236
def __init__ (self , cbar ):
237
237
self ._cbar = cbar
@@ -267,7 +267,7 @@ def __call__(self, ax, renderer):
267
267
pos = pos .shrunk (1 , shrink ).translated (0 , offset * pos .height )
268
268
else :
269
269
if aspect :
270
- self ._cbar .set_aspect (1 / (aspect / shrink ))
270
+ self ._cbar .set_aspect ((aspect / shrink ))
271
271
pos = pos .shrunk (shrink , 1 ).translated (offset * pos .width , 0 )
272
272
return pos
273
273
@@ -621,7 +621,7 @@ def _do_extends(self, extendlen):
621
621
# rectangle:
622
622
xyout = np .array ([[0 , 0 ], [0 , bot ], [1 , bot ], [1 , 0 ],
623
623
[1 , 1 ], [1 , top ], [0 , top ], [0 , 1 ],
624
- [0 , bot ]])
624
+ [0 , 0 ]])
625
625
626
626
if self .orientation == 'horizontal' :
627
627
xyout = xyout [:, ::- 1 ]
@@ -915,7 +915,7 @@ def set_alpha(self, alpha):
915
915
"""Set the transparency between 0 (transparent) and 1 (opaque)."""
916
916
self .alpha = alpha
917
917
918
- def set_scale (self , scale , ** kwargs ):
918
+ def set_scale (self , scale , ** kwargs ):
919
919
"""
920
920
Set the colorbar long axis scale.
921
921
@@ -1090,7 +1090,6 @@ def _mesh(self):
1090
1090
(self .__scale == 'manual' )):
1091
1091
# if a norm doesn't have a named scale, or we are not using a norm:
1092
1092
dv = self .vmax - self .vmin
1093
- # x = x * dv + self.vmin
1094
1093
y = y * dv + self .vmin
1095
1094
else :
1096
1095
y = norm .inverse (y )
@@ -1318,7 +1317,7 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15,
1318
1317
1319
1318
anchor = kw .pop ('anchor' , loc_settings ['anchor' ])
1320
1319
panchor = kw .pop ('panchor' , loc_settings ['panchor' ])
1321
-
1320
+ aspect0 = aspect
1322
1321
# turn parents into a list if it is not already. We do this w/ np
1323
1322
# because `plt.subplots` can return an ndarray and is natural to
1324
1323
# pass to `colorbar`.
@@ -1376,7 +1375,7 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15,
1376
1375
anchor = anchor ,
1377
1376
panchor = panchor ,
1378
1377
fraction = fraction ,
1379
- aspect = aspect ,
1378
+ aspect = aspect0 ,
1380
1379
pad = pad )
1381
1380
# and we need to set the aspect ratio by hand...
1382
1381
cax .set_anchor (anchor )
@@ -1435,7 +1434,7 @@ def make_axes_gridspec(parent, *, location=None, orientation=None,
1435
1434
panchor = kw .pop ('panchor' , loc_settings ['panchor' ])
1436
1435
pad = kw .pop ('pad' , loc_settings ["pad" ])
1437
1436
wh_space = 2 * pad / (1 - pad )
1438
-
1437
+ aspect0 = aspect
1439
1438
if location in ('left' , 'right' ):
1440
1439
# for shrinking
1441
1440
height_ratios = [
@@ -1492,7 +1491,7 @@ def make_axes_gridspec(parent, *, location=None, orientation=None,
1492
1491
anchor = anchor ,
1493
1492
panchor = panchor ,
1494
1493
fraction = fraction ,
1495
- aspect = aspect ,
1494
+ aspect = aspect0 ,
1496
1495
pad = pad )
1497
1496
return cax , kw
1498
1497
0 commit comments