MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / new_axes

Method new_axes

lib/matplotlib/widgets.py:2820–2847  ·  view source on GitHub ↗

Set SpanSelector to operate on a new Axes.

(self, ax, *, _props=None, _init=False)

Source from the content-addressed store, hash-verified

2818 self._active_handle = None
2819
2820 def new_axes(self, ax, *, _props=None, _init=False):
2821 """Set SpanSelector to operate on a new Axes."""
2822 reconnect = False
2823 if _init or self.canvas is not ax.get_figure(root=True).canvas:
2824 if self.canvas is not None:
2825 self.disconnect_events()
2826 reconnect = True
2827 self.ax = ax
2828 if reconnect:
2829 self.connect_default_events()
2830
2831 # Reset
2832 self._selection_completed = False
2833
2834 if self.direction == 'horizontal':
2835 trans = ax.get_xaxis_transform()
2836 w, h = 0, 1
2837 else:
2838 trans = ax.get_yaxis_transform()
2839 w, h = 1, 0
2840 rect_artist = Rectangle((0, 0), w, h, transform=trans, visible=False)
2841 if _props is not None:
2842 rect_artist.update(_props)
2843 elif self._selection_artist is not None:
2844 rect_artist.update_from(self._selection_artist)
2845
2846 self.ax.add_patch(rect_artist)
2847 self._selection_artist = rect_artist
2848
2849 def _setup_edge_handles(self, props):
2850 # Define initial position using the axis bounds to keep the same bounds

Callers 2

__init__Method · 0.95
directionMethod · 0.95

Calls 9

RectangleClass · 0.85
disconnect_eventsMethod · 0.80
add_patchMethod · 0.80
get_figureMethod · 0.45
get_xaxis_transformMethod · 0.45
get_yaxis_transformMethod · 0.45
updateMethod · 0.45
update_fromMethod · 0.45

Tested by

no test coverage detected