43
43
# All the other methods should go in the _AxesBase class.
44
44
45
45
46
+ def _make_axes_method (func ):
47
+ """
48
+ Patch the qualname for functions that are directly added to Axes.
49
+
50
+ Some Axes functionality is defined in functions in other submodules.
51
+ These are simply added as attributes to Axes. As a result, their
52
+ ``__qualname__`` is e.g. only "table" and not "Axes.table". This
53
+ function fixes that.
54
+
55
+ Note that the function itself is patched, so that
56
+ ``matplotlib.table.table.__qualname__` will also show "Axes.table".
57
+ However, since these functions are not intended to be standalone,
58
+ this is bearable.
59
+ """
60
+ func .__qualname__ = f"Axes.{ func .__name__ } "
61
+ return func
62
+
63
+
46
64
@_docstring .interpd
47
65
class Axes (_AxesBase ):
48
66
"""
@@ -8541,18 +8559,19 @@ def violin(self, vpstats, positions=None, vert=True, widths=0.5,
8541
8559
8542
8560
# Methods that are entirely implemented in other modules.
8543
8561
8544
- table = mtable .table
8562
+ table = _make_axes_method ( mtable .table )
8545
8563
8546
8564
# args can be either Y or y1, y2, ... and all should be replaced
8547
- stackplot = _preprocess_data ()(mstack .stackplot )
8565
+ stackplot = _preprocess_data ()(_make_axes_method ( mstack .stackplot ) )
8548
8566
8549
8567
streamplot = _preprocess_data (
8550
- replace_names = ["x" , "y" , "u" , "v" , "start_points" ])(mstream .streamplot )
8568
+ replace_names = ["x" , "y" , "u" , "v" , "start_points" ])(
8569
+ _make_axes_method (mstream .streamplot ))
8551
8570
8552
- tricontour = mtri .tricontour
8553
- tricontourf = mtri .tricontourf
8554
- tripcolor = mtri .tripcolor
8555
- triplot = mtri .triplot
8571
+ tricontour = _make_axes_method ( mtri .tricontour )
8572
+ tricontourf = _make_axes_method ( mtri .tricontourf )
8573
+ tripcolor = _make_axes_method ( mtri .tripcolor )
8574
+ triplot = _make_axes_method ( mtri .triplot )
8556
8575
8557
8576
def _get_aspect_ratio (self ):
8558
8577
"""
0 commit comments