matplotlib.widgets.ToolLineHandles#

classmatplotlib.widgets.ToolLineHandles(ax,positions,direction,*,line_props=None,useblit=True)[source]#

Control handles for canvas tools.

Parameters:
axAxes

Matplotlib Axes where tool handles are displayed.

positions1D array

Positions of handles in data coordinates.

direction{"horizontal", "vertical"}

Direction of handles, either 'vertical' or 'horizontal'

line_propsdict, optional

Additional line properties. SeeLine2D.

useblitbool, default: True

Whether to use blitting for faster drawing (if supported by thebackend). See the tutorialFaster rendering by using blittingfor details.

__init__(ax,positions,direction,*,line_props=None,useblit=True)[source]#

Methods

__init__(ax, positions, direction, *[, ...])

closest(x, y)

Return index and pixel distance to closest handle.

remove()

Remove the handles artist from the figure.

set_animated(value)

Set the animated state of the handles artist.

set_data(positions)

Set x- or y-positions of handles, depending on if the lines are vertical or horizontal.

set_visible(value)

Set the visibility state of the handles artist.

Attributes

artists

direction

Direction of the handle: 'vertical' or 'horizontal'.

positions

Positions of the handle in data coordinates.

propertyartists#
closest(x,y)[source]#

Return index and pixel distance to closest handle.

Parameters:
x, yfloat

x, y position from which the distance will be calculated todeterminate the closest handle

Returns:
index, distanceindex of the handle and its distance from

position x, y

propertydirection#

Direction of the handle: 'vertical' or 'horizontal'.

propertypositions#

Positions of the handle in data coordinates.

remove()[source]#

Remove the handles artist from the figure.

set_animated(value)[source]#

Set the animated state of the handles artist.

set_data(positions)[source]#

Set x- or y-positions of handles, depending on if the lines arevertical or horizontal.

Parameters:
positionstuple of length 2

Set the positions of the handle in data coordinates

set_visible(value)[source]#

Set the visibility state of the handles artist.