Skip to content

Commit 735de0d

Browse files
committed
FIX: make patch relim depend on transform versus new kwarg
1 parent c118f84 commit 735de0d

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

lib/matplotlib/axes/_base.py

+4-10
Original file line numberDiff line numberDiff line change
@@ -2336,23 +2336,15 @@ def _update_line_limits(self, line):
23362336
updatex=updatex, updatey=updatey)
23372337
self.ignore_existing_data_limits = False
23382338

2339-
def add_patch(self, p, relim=True):
2339+
def add_patch(self, p):
23402340
"""
23412341
Add a `.Patch` to the Axes; return the patch.
2342-
2343-
Parameters
2344-
----------
2345-
p : `.Patch`
2346-
Patch to add to the axes.
2347-
relim : bool, default True
2348-
Whether the patch triggers an axes relim.
23492342
"""
23502343
self._deprecate_noninstance('add_patch', mpatches.Patch, p=p)
23512344
self._set_artist_props(p)
23522345
if p.get_clip_path() is None:
23532346
p.set_clip_path(self.patch)
2354-
if relim:
2355-
self._update_patch_limits(p)
2347+
self._update_patch_limits(p)
23562348
self._children.append(p)
23572349
p._remove_method = self._children.remove
23582350
return p
@@ -2377,6 +2369,8 @@ def _update_patch_limits(self, patch):
23772369
return
23782370
patch_trf = patch.get_transform()
23792371
updatex, updatey = patch_trf.contains_branch_seperately(self.transData)
2372+
if not (updatex or updatey):
2373+
return
23802374
if self.name != "rectilinear":
23812375
# As in _update_line_limits, but for axvspan.
23822376
if updatex and patch_trf == self.get_yaxis_transform():

lib/matplotlib/colorbar.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ def _do_extends(self, extendlen):
672672
mpath.Path(xy), facecolor=color, linewidth=0,
673673
antialiased=False, transform=self.ax.transAxes,
674674
hatch=hatches[0], clip_on=False)
675-
self.ax.add_patch(patch, relim=False)
675+
self.ax.add_patch(patch)
676676
if self._extend_upper():
677677
if not self.extendrect:
678678
# triangle
@@ -688,7 +688,7 @@ def _do_extends(self, extendlen):
688688
mpath.Path(xy), facecolor=color,
689689
linewidth=0, antialiased=False,
690690
transform=self.ax.transAxes, hatch=hatches[-1], clip_on=False)
691-
self.ax.add_patch(patch, relim=False)
691+
self.ax.add_patch(patch)
692692
return
693693

694694
def add_lines(self, *args, **kwargs):

0 commit comments

Comments
 (0)