mpl_interactions.interactive_axhline

interactive_axhline(y=0, xmin=0, xmax=1, ax=None, slider_formats=None, force_ipywidgets=False, play_buttons=False, controls=None, display_controls=True, **kwargs)[source]

Control an horizontal line using widgets.

Parameters
  • y (float or function) – y position in data coordinates of the horizontal line.

  • xmin (float or function) – Should be between 0 and 1, 0 being the far left of the plot, 1 the far right of the plot.

  • xmax (float or function) – Should be between 0 and 1, 0 being the far left of the plot, 1 the far right of the plot.

  • ax (matplotlib axis, optional) – If None a new figure and axis will be created

  • slider_formats (None, string, or dict) – If None a default value of decimal points will be used. Uses the new {} style formatting

  • force_ipywidgets (boolean) – If True ipywidgets will always be used, even if not using the ipympl backend. If False the function will try to detect if it is ok to use ipywidgets If ipywidgets are not used the function will fall back on matplotlib widgets

  • play_buttons (bool or str or dict, optional) – Whether to attach an ipywidgets.Play widget to any sliders that get created. If a boolean it will apply to all kwargs, if a dictionary you choose which sliders you want to attach play buttons too.

    • None: no sliders

    • True: sliders on the lft

    • False: no sliders

    • ‘left’: sliders on the left

    • ‘right’: sliders on the right

  • controls (mpl_interactions.controller.Controls) – An existing controls object if you want to tie multiple plot elements to the same set of controls

  • display_controls (boolean) – Whether the controls should display themselve on creation. Ignored if controls is specified.

Returns

controls