|
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 | """
|
@@ -8534,18 +8552,19 @@ def violin(self, vpstats, positions=None, vert=True, widths=0.5,
|
8534 | 8552 |
|
8535 | 8553 | # Methods that are entirely implemented in other modules.
|
8536 | 8554 |
|
8537 |
| - table = mtable.table |
| 8555 | + table = _make_axes_method(mtable.table) |
8538 | 8556 |
|
8539 | 8557 | # args can be either Y or y1, y2, ... and all should be replaced
|
8540 |
| - stackplot = _preprocess_data()(mstack.stackplot) |
| 8558 | + stackplot = _preprocess_data()(_make_axes_method(mstack.stackplot)) |
8541 | 8559 |
|
8542 | 8560 | streamplot = _preprocess_data(
|
8543 |
| - replace_names=["x", "y", "u", "v", "start_points"])(mstream.streamplot) |
| 8561 | + replace_names=["x", "y", "u", "v", "start_points"])( |
| 8562 | + _make_axes_method(mstream.streamplot)) |
8544 | 8563 |
|
8545 |
| - tricontour = mtri.tricontour |
8546 |
| - tricontourf = mtri.tricontourf |
8547 |
| - tripcolor = mtri.tripcolor |
8548 |
| - triplot = mtri.triplot |
| 8564 | + tricontour = _make_axes_method(mtri.tricontour) |
| 8565 | + tricontourf = _make_axes_method(mtri.tricontourf) |
| 8566 | + tripcolor = _make_axes_method(mtri.tripcolor) |
| 8567 | + triplot = _make_axes_method(mtri.triplot) |
8549 | 8568 |
|
8550 | 8569 | def _get_aspect_ratio(self):
|
8551 | 8570 | """
|
|
0 commit comments