mpl_interactions.interactive_axvline

interactive_axvline(x=0, ymin=0, ymax=1, ax=None, slider_formats=None, force_ipywidgets=False, play_buttons=False, controls=None, display_controls=True, **kwargs)[source]

Control a vertical line using widgets.

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

  • ymin (float or function) – Should be between 0 and 1, 0 being the bottom of the plot, 1 the far top of the plot

  • ymax (float or function) – Should be between 0 and 1, 0 being the top of the plot, 1 the top 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.

  • **kwargs – Kwargs will be used to create control widgets. Except kwargs that are valid for Line2D are extracted and passed through to the creation of the line.

Returns

controls