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 a9d4ccc

Browse filesBrowse files
authored
Merge pull request #12855 from anntzer/cleanup
Cleanup axes/_base.py.
2 parents d4d8c08 + b72518a commit a9d4ccc
Copy full SHA for a9d4ccc

File tree

Expand file treeCollapse file tree

3 files changed

+21
-48
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+21
-48
lines changed

‎lib/matplotlib/artist.py

Copy file name to clipboardExpand all lines: lib/matplotlib/artist.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ def hitlist(self, event):
378378
return L
379379

380380
def get_children(self):
381-
r"""Return a list of the child `.Artist`\s this `.Artist` contains."""
381+
r"""Return a list of the child `.Artist`\s of this `.Artist`."""
382382
return []
383383

384384
def contains(self, mouseevent):

‎lib/matplotlib/axes/_base.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_base.py
+20-44Lines changed: 20 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4208,60 +4208,36 @@ def format_deltas(key, dx, dy):
42084208
self.set_ylim(points[:, 1])
42094209

42104210
def get_children(self):
4211-
"""return a list of child artists"""
4212-
children = []
4213-
children.extend(self.collections)
4214-
children.extend(self.patches)
4215-
children.extend(self.lines)
4216-
children.extend(self.texts)
4217-
children.extend(self.artists)
4218-
children.extend(self.spines.values())
4219-
children.append(self.xaxis)
4220-
children.append(self.yaxis)
4221-
children.append(self.title)
4222-
children.append(self._left_title)
4223-
children.append(self._right_title)
4224-
children.extend(self.tables)
4225-
children.extend(self.images)
4226-
children.extend(self.child_axes)
4227-
4228-
if self.legend_ is not None:
4229-
children.append(self.legend_)
4230-
children.append(self.patch)
4231-
4232-
return children
4211+
# docstring inherited.
4212+
return [
4213+
*self.collections,
4214+
*self.patches,
4215+
*self.lines,
4216+
*self.texts,
4217+
*self.artists,
4218+
*self.spines.values(),
4219+
*self._get_axis_list(),
4220+
self.title, self._left_title, self._right_title,
4221+
*self.tables,
4222+
*self.images,
4223+
*self.child_axes,
4224+
*([self.legend_] if self.legend_ is not None else []),
4225+
self.patch,
4226+
]
42334227

42344228
def contains(self, mouseevent):
4235-
"""
4236-
Test whether the mouse event occurred in the axes.
4237-
4238-
Returns *True* / *False*, {}
4239-
"""
4229+
# docstring inherited.
42404230
if callable(self._contains):
42414231
return self._contains(self, mouseevent)
42424232
return self.patch.contains(mouseevent)
42434233

42444234
def contains_point(self, point):
42454235
"""
4246-
Returns *True* if the point (tuple of x,y) is inside the axes
4247-
(the area defined by the its patch). A pixel coordinate is
4248-
required.
4249-
4236+
Returns whether *point* (pair of pixel coordinates) is inside the axes
4237+
patch.
42504238
"""
42514239
return self.patch.contains_point(point, radius=1.0)
42524240

4253-
def pick(self, *args):
4254-
"""Trigger pick event
4255-
4256-
Call signature::
4257-
4258-
pick(mouseevent)
4259-
4260-
each child artist will fire a pick event if mouseevent is over
4261-
the artist and the artist has picker set
4262-
"""
4263-
martist.Artist.pick(self, args[0])
4264-
42654241
def get_default_bbox_extra_artists(self):
42664242
"""
42674243
Return a default list of artists that are used for the bounding box
@@ -4285,7 +4261,7 @@ def get_default_bbox_extra_artists(self):
42854261
if (artist.get_visible() and artist.get_in_layout())]
42864262

42874263
def get_tightbbox(self, renderer, call_axes_locator=True,
4288-
bbox_extra_artists=None):
4264+
bbox_extra_artists=None):
42894265
"""
42904266
Return the tight bounding box of the axes, including axis and their
42914267
decorators (xlabel, title, etc).

‎lib/mpl_toolkits/mplot3d/axes3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/axes3d.py
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,6 @@ def _init_axis(self):
210210
for ax in self.xaxis, self.yaxis, self.zaxis:
211211
ax.init3d()
212212

213-
def get_children(self):
214-
return [self.zaxis] + super().get_children()
215-
216213
def _get_axis_list(self):
217214
return super()._get_axis_list() + (self.zaxis, )
218215

0 commit comments

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