Skip to content

Commit cce57fe

Browse files
authored
Merge pull request #8150 from anntzer/deprecate-figurePatch-axesPatch
Deprecate Axes.axesPatch, Figure.figurePatch.
2 parents a6c32f8 + 0a0fd5e commit cce57fe

File tree

5 files changed

+20
-16
lines changed

5 files changed

+20
-16
lines changed

examples/api/logo2.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
figcolor = 'white'
2121
dpi = 80
2222
fig = plt.figure(figsize=(6, 1.1), dpi=dpi)
23-
fig.figurePatch.set_edgecolor(figcolor)
24-
fig.figurePatch.set_facecolor(figcolor)
23+
fig.patch.set_edgecolor(figcolor)
24+
fig.patch.set_facecolor(figcolor)
2525

2626

2727
def add_math_background():
@@ -57,7 +57,7 @@ def add_matplotlib_text(ax):
5757
def add_polar_bar():
5858
ax = fig.add_axes([0.025, 0.075, 0.2, 0.85], projection='polar')
5959

60-
ax.axesPatch.set_alpha(axalpha)
60+
ax.patch.set_alpha(axalpha)
6161
ax.set_axisbelow(True)
6262
N = 7
6363
arc = 2. * np.pi

examples/event_handling/viewlims.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def ax_update(self, ax):
4242
ax.set_autoscale_on(False) # Otherwise, infinite loop
4343

4444
# Get the number of points from the number of pixels in the window
45-
dims = ax.axesPatch.get_window_extent().bounds
45+
dims = ax.patch.get_window_extent().bounds
4646
self.width = int(dims[2] + 0.5)
4747
self.height = int(dims[2] + 0.5)
4848

lib/matplotlib/axes/_base.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,11 +1080,10 @@ def cla(self):
10801080
_title.set_clip_box(None)
10811081
self._set_artist_props(_title)
10821082

1083-
# the patch draws the background of the axes. we want this to
1084-
# be below the other artists; the axesPatch name is
1085-
# deprecated. We use the frame to draw the edges so we are
1086-
# setting the edgecolor to None
1087-
self.patch = self.axesPatch = self._gen_axes_patch()
1083+
# The patch draws the background of the axes. We want this to be below
1084+
# the other artists. We use the frame to draw the edges so we are
1085+
# setting the edgecolor to None.
1086+
self.patch = self._gen_axes_patch()
10881087
self.patch.set_figure(self.figure)
10891088
self.patch.set_facecolor(self._facecolor)
10901089
self.patch.set_edgecolor('None')
@@ -1107,6 +1106,10 @@ def cla(self):
11071106
self.patch.set_visible(patch_visible)
11081107
self.stale = True
11091108

1109+
@cbook.deprecated("2.1", alternative="Axes.patch")
1110+
def axesPatch(self):
1111+
return self.patch
1112+
11101113
def clear(self):
11111114
"""clear the axes"""
11121115
self.cla()

lib/matplotlib/figure.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -332,12 +332,9 @@ def __init__(self,
332332

333333
self.transFigure = BboxTransformTo(self.bbox)
334334

335-
# the figurePatch name is deprecated
336-
self.patch = self.figurePatch = Rectangle(
335+
self.patch = Rectangle(
337336
xy=(0, 0), width=1, height=1,
338-
facecolor=facecolor, edgecolor=edgecolor,
339-
linewidth=linewidth)
340-
337+
facecolor=facecolor, edgecolor=edgecolor, linewidth=linewidth)
341338
self._set_artist_props(self.patch)
342339
self.patch.set_aa(False)
343340

@@ -358,6 +355,10 @@ def __init__(self,
358355
self.clf()
359356
self._cachedRenderer = None
360357

358+
@cbook.deprecated("2.1", alternative="Figure.patch")
359+
def figurePatch(self):
360+
return self.patch
361+
361362
# TODO: I'd like to dynamically add the _repr_html_ method
362363
# to the figure in the right context, but then IPython doesn't
363364
# use it, for some reason.

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def __init__(self, fig, rect=None, *args, **kwargs):
118118
self.mouse_init()
119119
self.set_top_view()
120120

121-
self.axesPatch.set_linewidth(0)
121+
self.patch.set_linewidth(0)
122122
# Calculate the pseudo-data width and height
123123
pseudo_bbox = self.transLimits.inverted().transform([(0, 0), (1, 1)])
124124
self._pseudo_w, self._pseudo_h = pseudo_bbox[1] - pseudo_bbox[0]
@@ -245,7 +245,7 @@ def tunit_edges(self, vals=None, M=None):
245245

246246
def draw(self, renderer):
247247
# draw the background patch
248-
self.axesPatch.draw(renderer)
248+
self.patch.draw(renderer)
249249
self._frameon = False
250250

251251
# first, set the aspect

0 commit comments

Comments
 (0)