matplotlib.widgets.Cursor#

class matplotlib.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

The Axes 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 tutorial Faster rendering by using blitting for details.

Other Parameters:
**lineprops

Line2D properties that control the appearance of the lines. See also axhline.

Examples

See Cursor.

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 using matplotlib.widgets.Cursor#

Annotated cursor

Annotated cursor

Cursor

Cursor