@@ -269,7 +269,7 @@ def __call__(self, ax, renderer):
269
269
offset = extendlen [0 ] / len
270
270
# we need to reset the aspect ratio of the axes to account
271
271
# of the extends...
272
- if not self . _cbar . _userax :
272
+ if hasattr<
10000
/span>( ax , '_colorbar_info' ) :
273
273
aspect = ax ._colorbar_info ['aspect' ]
274
274
else :
275
275
aspect = False
@@ -278,15 +278,13 @@ def __call__(self, ax, renderer):
278
278
if self ._cbar .orientation == 'vertical' :
279
279
if aspect :
280
280
ax .set_aspect (aspect * shrink )
281
- offset = offset * pos .height
282
- pos = pos .shrunk (1 , shrink ).translated (0 , offset )
281
+ pos = pos .shrunk (1 , shrink ).translated (0 , offset * pos .height )
283
282
else :
284
283
if aspect :
285
284
ax .set_aspect (aspect / shrink )
286
- offset = offset * pos .width
287
- pos = pos .shrunk (shrink , 1 ).translated (offset , 0 )
285
+ pos = pos .shrunk (shrink , 1 ).translated (offset * pos .width , 0 )
288
286
return pos
289
-
287
+
290
288
def get_subplotspec (self ):
291
289
# make tight_layout happy..
292
290
return self ._cbar .ax .get_subplotspec ()
@@ -368,9 +366,6 @@ class Colorbar:
368
366
extendrec
369
367
370
368
label : str
371
-
372
- userax : boolean
373
- Whether the user created the axes or not. Default True
374
369
"""
375
370
376
371
n_rasterize = 50 # rasterize solids if number of colors >= n_rasterize
@@ -391,7 +386,6 @@ def __init__(self, ax, mappable=None, *, cmap=None,
391
386
extendfrac = None ,
392
387
extendrect = False ,
393
388
label = '' ,
394
- userax = True ,
395
389
):
396
390
397
391
if mappable is None :
@@ -431,7 +425,6 @@ def __init__(self, ax, mappable=None, *, cmap=None,
431
425
['uniform' , 'proportional' ], spacing = spacing )
432
426
433
427
self .ax = ax
434
- self ._userax = userax
435
428
self .ax ._axes_locator = _ColorbarAxesLocator (self )
436
429
ax .set (navigate = False )
437
430
@@ -621,20 +614,21 @@ def _do_extends(self, extendlen):
621
614
"""
622
615
# extend lengths are fraction of the *inner* part of colorbar,
623
616
# not the total colorbar:
624
- elower = extendlen [0 ] if self ._extend_lower () else 0
625
- eupper = extendlen [1 ] if self ._extend_upper () else 0
626
- top = eupper + 1
617
+ bot = extendlen [0 ] if self ._extend_lower () else 0
618
+ bot = - bot
619
+ top = extendlen [1 ] if self ._extend_upper () else 0
620
+ top = top + 1
627
621
628
622
# xyout is the outline of the colorbar including the extend patches:
629
623
if not self .extendrect :
630
624
# triangle:
631
- xyout = np .array ([[0 , 0 ], [0.5 , - elower ], [1 , 0 ],
625
+ xyout = np .array ([[0 , 0 ], [0.5 , bot ], [1 , 0 ],
632
626
[1 , 1 ], [0.5 , top ], [0 , 1 ], [0 , 0 ]])
633
627
else :
634
628
# rectangle:
635
- xyout = np .array ([[0 , 0 ], [0 , - elower ], [1 , - elower ], [1 , 0 ],
629
+ xyout = np .array ([[0 , 0 ], [0 , bot ], [1 , bot ], [1 , 0 ],
636
630
[1 , 1 ], [1 , top ], [0 , top ], [0 , 1 ],
637
- [0 , - elower ]])
631
+ [0 , bot ]])
638
632
639
633
if self .orientation == 'horizontal' :
640
634
xyout = xyout [:, ::- 1 ]
@@ -656,10 +650,10 @@ def _do_extends(self, extendlen):
656
650
if self ._extend_lower ():
657
651
if not self .extendrect :
658
652
# triangle
659
- xy = np .array ([[0.5 , - elower ], [1 , 0 ], [0 , 0 ]])
653
+ xy = np .array ([[0.5 , bot ], [1 , 0 ], [0 , 0 ]])
660
654
else :
661
655
# rectangle
662
- xy = np .array ([[0 , - elower ], [1. , - elower ], [1 , 0 ], [0 , 0 ]])
656
+ xy = np .array ([[0 , bot ], [1. , bot ], [1 , 0 ], [0 , 0 ]])
663
657
if self .orientation == 'horizontal' :
664
658
xy = xy [:, ::- 1 ]
665
659
# add the patch
0 commit comments