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 acab5a5

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 191e233 commit acab5a5
Copy full SHA for acab5a5

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
@@ -1103,7 +1104,6 @@ def cla(self):
11031104

11041105
self._gridOn = mpl.rcParams['axes.grid']
11051106
self._children = []
1106-
self.tables = []
11071107
self.artists = []
11081108
self.images = []
11091109
self._mouseover_set = _OrderedSet()
@@ -1187,6 +1187,10 @@ def patches(self):
11871187
return tuple(a for a in self._children
11881188
if isinstance(a, mpatches.Patch))
11891189

1190+
@property
1191+
def tables(self):
1192+
return tuple(a for a in self._children if isinstance(a, mtable.Table))
1193+
11901194
@property
11911195
def texts(self):
11921196
return tuple(a for a in self._children if isinstance(a, mtext.Text))
@@ -2086,12 +2090,12 @@ def _update_patch_limits(self, patch):
20862090

20872091
def add_table(self, tab):
20882092
"""
2089-
Add a `~.Table` to the axes' tables; return the table.
2093+
Add a `~.Table` to the Axes; return the table.
20902094
"""
20912095
self._set_artist_props(tab)
2092-
self.tables.append(tab)
2096+
self._children.append(tab)
20932097
tab.set_clip_path(self.patch)
2094-
tab._remove_method = self.tables.remove
2098+
tab._remove_method = self._children.remove
20952099
return tab
20962100

20972101
def add_container(self, container):
@@ -4071,7 +4075,6 @@ def get_children(self):
40714075
*self.spines.values(),
40724076
*self._get_axis_list(),
40734077
self.title, self._left_title, self._right_title,
4074-
*self.tables,
40754078
*self.images,
40764079
*self.child_axes,
40774080
*([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.