matplotlib.widgets.Cursor#

classmatplotlib.widgets.Cursor(ax,*,horizOn=True,vertOn=True,useblit=False,**lineprops)[source]#

Bases:AxesWidget

A crosshair cursor that spans the Axes and moves with mouse cursor.

For the cursor to remain responsive you must keep a reference to it.

Parameters:
axAxes

TheAxes to attach the cursor to.

horizOnbool, default: True

Whether to draw the horizontal line.

vertOnbool, default: True

Whether to draw the vertical line.

useblitbool, default: False

Use blitting for faster drawing if supported by the backend.See the tutorialFaster rendering by using blitting for details.

Other Parameters:
**lineprops

Line2D properties that control the appearance of the lines.See alsoaxhline.

Examples

SeeCursor.

clear(event)[source]#

Internal event handler to clear the cursor.

onmove(event)[source]#

Internal event handler to draw the cursor when the mouse moves.

Examples usingmatplotlib.widgets.Cursor#

Annotated cursor

Annotated cursor

Cursor

Cursor