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

Method __init__

lib/matplotlib/widgets.py:2075–2102  ·  view source on GitHub ↗
(self, ax, *, horizOn=True, vertOn=True, useblit=False,
                 **lineprops)

Source from the content-addressed store, hash-verified

2073 See :doc:`/gallery/widgets/cursor`.
2074 """
2075 def __init__(self, ax, *, horizOn=True, vertOn=True, useblit=False,
2076 **lineprops):
2077 super().__init__(ax)
2078
2079 self.connect_event('motion_notify_event', self.onmove)
2080 self.connect_event('draw_event', self.clear)
2081
2082 self.visible = True
2083 self.horizOn = horizOn
2084 self.vertOn = vertOn
2085 self.useblit = useblit and self.canvas.supports_blit # TODO: make dynamic
2086
2087 if self.useblit:
2088 for ax_ in ax.get_figure(root=True).get_axes():
2089 if ax_ is not ax and ax.bbox.overlaps(ax_.bbox):
2090 _api.warn_external(
2091 "Cursor blitting is currently not supported on "
2092 "overlapping axes; falling back to useblit=False."
2093 )
2094 self.useblit = False
2095 break
2096
2097 if self.useblit:
2098 lineprops['animated'] = True
2099 self.lineh = ax.axhline(ax.get_ybound()[0], visible=False, **lineprops)
2100 self.linev = ax.axvline(ax.get_xbound()[0], visible=False, **lineprops)
2101
2102 self.needclear = False
2103
2104 def clear(self, event):
2105 """Internal event handler to clear the cursor."""

Callers

nothing calls this directly

Calls 8

connect_eventMethod · 0.80
overlapsMethod · 0.80
axhlineMethod · 0.80
get_yboundMethod · 0.80
axvlineMethod · 0.80
get_xboundMethod · 0.80
__init__Method · 0.45
get_figureMethod · 0.45

Tested by

no test coverage detected