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 380c9f2

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

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
@@ -23,6 +23,7 @@
2323
import matplotlib.axis as maxis
2424
import matplotlib.spines as mspines
2525
import matplotlib.font_manager as font_manager
26+
import matplotlib.table as mtable
2627
import matplotlib.text as mtext
2728
import matplotlib.image as mimage
2829
from matplotlib.rcsetup import cycler, validate_axisbelow
@@ -1146,7 +1147,6 @@ def cla(self):
11461147

11471148
self._gridOn = mpl.rcParams['axes.grid']
11481149
self._children = []
1149-
self.tables = []
11501150
self.artists = []
11511151
self.images = []
11521152
self._mouseover_set = _OrderedSet()
@@ -1230,6 +1230,10 @@ def patches(self):
12301230
return tuple(a for a in self._children
12311231
if isinstance(a, mpatches.Patch))
12321232

1233+
@property
1234+
def tables(self):
1235+
return tuple(a for a in self._children if isinstance(a, mtable.Table))
1236+
12331237
@property
12341238
def texts(self):
12351239
return tuple(a for a in self._children if isinstance(a, mtext.Text))
@@ -2122,12 +2126,12 @@ def _update_patch_limits(self, patch):
21222126

21232127
def add_table(self, tab):
21242128
"""
2125-
Add a `~.Table` to the axes' tables; return the table.
2129+
Add a `~.Table` to the Axes; return the table.
21262130
"""
21272131
self._set_artist_props(tab)
2128-
self.tables.append(tab)
2132+
self._children.append(tab)
21292133
tab.set_clip_path(self.patch)
2130-
tab._remove_method = self.tables.remove
2134+
tab._remove_method = self._children.remove
21312135
return tab
21322136

21332137
def add_container(self, container):
@@ -4246,7 +4250,6 @@ def get_children(self):
42464250
*self.spines.values(),
42474251
*self._get_axis_list(),
42484252
self.title, self._left_title, self._right_title,
4249-
*self.tables,
42504253
*self.images,
42514254
*self.child_axes,
42524255
*([self.legend_] if self.legend_ is not None else []),

0 commit comments

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