10000 TST: fix test images · matplotlib/matplotlib@114e8d3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 114e8d3

Browse files
committed
TST: fix test images
1 parent 0deed5f commit 114e8d3

File tree

9 files changed

+385
-396
lines changed

9 files changed

+385
-396
lines changed

lib/matplotlib/colorbar.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919

2020
import matplotlib as mpl
2121
from matplotlib import _api, collections, cm, colors, contour, ticker
22-
from matplotlib.axes._base import _TransformedBoundsLocator
23-
from matplotlib.axes._axes import Axes
2422
import matplotlib.artist as martist
2523
import matplotlib.patches as mpatches
2624
import matplotlib.path as mpath
@@ -240,24 +238,32 @@ def __init__(self, cbar):
240238
self._orig_locator = cbar.ax._axes_locator
241239

242240
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+
246251
pos = ax.get_position(original=True)
247252
if self._orig_locator is not None:
248253
pos = self._orig_locator(ax, renderer)
249254
if self._cbar.extend == 'neither':
250-
return pos
255+
return pos
251256
else:
252257
y, extendlen = self._cbar._proportional_y()
253258
if not self._cbar._extend_lower():
254259
extendlen[0] = 0
255260
if not self._cbar._extend_upper():
256261
extendlen[1] = 0
257-
len = sum(extendlen) + 1
262+
len = sum(extendlen) + 1
258263
shrink = 1 / len
259264
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...
261267
if not self._cbar._userax:
262268
aspect = ax._colorbar_info['aspect']
263269
else:
@@ -608,8 +614,8 @@ def _do_extends(self, extendlen):
608614
elower = extendlen[0] if self._extend_lower() else 0
609615
eupper = extendlen[1] if self._extend_upper() else 0
610616
total_len = eupper + elower + 1
611-
elower = elower
612-
eupper = eupper
617+
elower = elower
618+
eupper = eupper
613619
inner_length = 1 / total_len
614620

615621
# make the inner axes smaller to make room for the extend rectangle
@@ -630,7 +636,6 @@ def _do_extends(self, extendlen):
630636
if self.orientation == 'horizontal':
631637
bounds = bounds[[1, 0, 3, 2]]
632638
xyout = xyout[:, ::-1]
633-
#self.ax._set_inner_bounds(bounds)
634639

635640
# xyout is the path for the spine:
636641
self.outline.set_xy(xyout)
Binary file not shown.
Loading

0 commit comments

Comments
 (0)
0