Common helper for removal of standard Axes (via delaxes) and of child Axes. Parameters ---------- ax : `~.AxesBase` The Axes to remove. owners List of objects (list or _AxesStack) "owning" the Axes, from which the Axes wil
(self, ax, owners)
| 934 | self._remove_axes(ax, owners=[self._axstack, self._localaxes]) |
| 935 | |
| 936 | def _remove_axes(self, ax, owners): |
| 937 | """ |
| 938 | Common helper for removal of standard Axes (via delaxes) and of child Axes. |
| 939 | |
| 940 | Parameters |
| 941 | ---------- |
| 942 | ax : `~.AxesBase` |
| 943 | The Axes to remove. |
| 944 | owners |
| 945 | List of objects (list or _AxesStack) "owning" the Axes, from which the Axes |
| 946 | will be remove()d. |
| 947 | """ |
| 948 | for owner in owners: |
| 949 | owner.remove(ax) |
| 950 | |
| 951 | self._axobservers.process("_axes_change_event", self) |
| 952 | self.stale = True |
| 953 | self._root_figure.canvas.release_mouse(ax) |
| 954 | |
| 955 | for name in ax._axis_names: # Break link between any shared Axes |
| 956 | grouper = ax._shared_axes[name] |
| 957 | siblings = grouper.get_siblings(ax, include_self=False) |
| 958 | if not siblings: # Axes was not shared along this axis; we're done. |
| 959 | continue |
| 960 | grouper.remove(ax) |
| 961 | # Formatters and locators may previously have been associated with the now |
| 962 | # removed axis. Update them to point to an axis still there (we can pick |
| 963 | # any of them, and use the first sibling). |
| 964 | remaining_axis = siblings[0]._axis_map[name] |
| 965 | remaining_axis.get_major_formatter().set_axis(remaining_axis) |
| 966 | remaining_axis.get_major_locator().set_axis(remaining_axis) |
| 967 | remaining_axis.get_minor_formatter().set_axis(remaining_axis) |
| 968 | remaining_axis.get_minor_locator().set_axis(remaining_axis) |
| 969 | |
| 970 | ax._twinned_axes.remove(ax) # Break link between any twinned Axes. |
| 971 | |
| 972 | def clear(self, keep_observers=False): |
| 973 | """ |
no test coverage detected