matplotlib.widgets.ToolLineHandles#
- class matplotlib.widgets.ToolLineHandles(ax, positions, direction, *, line_props=None, useblit=True)[source]#
Control handles for canvas tools.
- Parameters:
- ax
Axes 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. See
Line2D.- useblitbool, default: True
Whether to use blitting for faster drawing (if supported by the backend). See the tutorial Faster rendering by using blitting for details.
- ax
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
Direction of the handle: 'vertical' or 'horizontal'.
Positions of the handle in data coordinates.
- property artists#
- 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 to determinate the closest handle
- Returns:
- index, distanceindex of the handle and its distance from
position x, y
- property direction#
Direction of the handle: 'vertical' or 'horizontal'.
- property positions#
Positions of the handle in data coordinates.