19
19
20
20
import matplotlib as mpl
21
21
from matplotlib import _api , collections , cm , colors , contour , ticker
22
- from matplotlib .axes ._base import _TransformedBoundsLocator
23
- from matplotlib .axes ._axes import Axes
24
22
import matplotlib .artist as martist
25
23
import matplotlib .patches as mpatches
26
24
import matplotlib .path as mpath
@@ -240,24 +238,32 @@ def __init__(self, cbar):
240
238
self ._orig_locator = cbar .ax ._axes_locator
241
239
242
240
def __call__ (self , ax , renderer ):
243
- # Subtracting transSubfigure will typically rely on inverted(),
244
- # freezing the transform; thus, this needs to be delayed until draw
245
- # time as transSubfigure may otherwise change after this is evaluated.
241
+
242
+ # make sure that lims and scales are the same
243
+ scale = self ._cbar ._long_axis ().get_scale ()
244
+ try :
245
+ self ._cbar ._short_axis ()._set_scale (scale )
246
+ except TypeError :
247
+ pass
248
+ lim = self ._cbar ._long_axis ().get_view_interval ()
249
+ self ._cbar ._short_axis ().set_view_interval (* lim )
250
+
246
251
pos = ax .get_position (original = True )
247
252
if self ._orig_locator is not None :
248
253
pos = self ._orig_locator (ax , renderer )
249
254
if self ._cbar .extend == 'neither' :
250
- return pos
255
+ return pos
251
256
else :
252
257
y , extendlen = self ._cbar ._proportional_y ()
253
258
if not self ._cbar ._extend_lower ():
254
259
extendlen [0 ] = 0
255
260
if not self ._cbar ._extend_upper ():
256
261
extendlen [1 ] = 0
257
- len = sum (extendlen ) + 1
262
+ len = sum (extendlen ) + 1
258
263
shrink = 1 / len
259
264
offset = extendlen [0 ] / len
260
- # we need to reset the aspect ratio of the axes to account fo the extends...
265
+ # we need to reset the aspect ratio of the axes to account
266
+ # of the extends...
261
267
if not self ._cbar ._userax :
262
268
aspect = ax ._colorbar_info ['aspect' ]
263
269
else :
@@ -608,8 +614,8 @@ def _do_extends(self, extendlen):
608
614
elower = extendlen [0 ] if self ._extend_lower () else 0
609
615
eupper = extendlen [1 ] if self ._extend_upper () else 0
610
616
total_len = eupper + elower + 1
611
- elower = elower
612
- eupper = eupper
617
+ elower = elower
618
+ eupper = eupper
613
619
inner_length = 1 / total_len
614
620
615
621
# make the inner axes smaller to make room for the extend rectangle
@@ -630,7 +636,6 @@ def _do_extends(self, extendlen):
630
636
if self .orientation == 'horizontal' :
631
637
bounds = bounds [[1 , 0 , 3 , 2 ]]
632
638
xyout = xyout [:, ::- 1 ]
633
- #self.ax._set_inner_bounds(bounds)
634
639
635
640
# xyout is the path for the spine:
636
641
self .outline .set_xy (xyout )
0 commit comments