Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d52a8c2

Browse filesBrowse files
committed
Move Axes.patches into hidden children attribute.
The patches can still be accessed via a read-only property, but now are combined with lines for sorting and overall drawing purposes.
1 parent 6e73943 commit d52a8c2
Copy full SHA for d52a8c2

File tree

Expand file treeCollapse file tree

1 file changed

+8
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-5
lines changed

‎lib/matplotlib/axes/_base.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_base.py
+8-5Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,7 +1146,6 @@ def cla(self):
11461146

11471147
self._gridOn = mpl.rcParams['axes.grid']
11481148
self._children = []
1149-
self.patches = []
11501149
self.texts = []
11511150
self.tables = []
11521151
self.artists = []
@@ -1227,6 +1226,11 @@ def cla(self):
12271226
def lines(self):
12281227
return tuple(a for a in self._children if isinstance(a, mlines.Line2D))
12291228

1229+
@property
1230+
def patches(self):
1231+
return tuple(a for a in self._children
1232+
if isinstance(a, mpatches.Patch))
1233+
12301234
def clear(self):
12311235
"""Clear the axes."""
12321236
self.cla()
@@ -2077,14 +2081,14 @@ def _update_line_limits(self, line):
20772081

20782082
def add_patch(self, p):
20792083
"""
2080-
Add a `~.Patch` to the axes' patches; return the patch.
2084+
Add a `~.Patch` to the Axes; return the patch.
20812085
"""
20822086
self._set_artist_props(p)
20832087
if p.get_clip_path() is None:
20842088
p.set_clip_path(self.patch)
20852089
self._update_patch_limits(p)
2086-
self.patches.append(p)
2087-
p._remove_method = self.patches.remove
2090+
self._children.append(p)
2091+
p._remove_method = self._children.remove
20882092
return p
20892093

20902094
def _update_patch_limits(self, patch):
@@ -4234,7 +4238,6 @@ def get_children(self):
42344238
# docstring inherited.
42354239
return [
42364240
*self.collections,
4237-
*self.patches,
42384241
*self._children,
42394242
*self.texts,
42404243
*self.artists,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.