anyplotlib.RangeWidget#

class anyplotlib.RangeWidget(push_fn, *, x0, x1, color='#00e5ff', style='band', y=0.0)[source]#

Bases: Widget

Draggable range selection widget.

Two display styles are available:

style='band' (default)

Two connected vertical lines with a translucent fill band. Either line can be dragged independently; the whole band can be dragged by clicking inside it.

style='fwhm'

Two circular handles joined by a dashed horizontal line drawn at height y (the half-maximum level). Only the x-positions of the handles are draggable. Use this to show/edit a FWHM interval on a peak.

Parameters:
  • push_fn (Callable) – Update callback.

  • x0 (float) – Initial left and right positions in data coordinates.

  • x1 (float) – Initial left and right positions in data coordinates.

  • color (str, optional) – CSS colour. Default "#00e5ff".

  • style ({'band', 'fwhm'}, optional) – Visual style. Default "band".

  • y (float, optional) – Y-position (data coordinates) for the connecting line when style='fwhm'. Ignored for style='band'. Default 0.0.