mpl_interactions.interactive_scatter

interactive_scatter(x, y=None, s=None, c=None, cmap=None, vmin=None, vmax=None, alpha=None, marker=None, edgecolors=None, facecolors=None, label=None, parametric=False, ax=None, slider_formats=None, xlim='stretch', ylim='stretch', force_ipywidgets=False, play_buttons=False, controls=None, display_controls=True, **kwargs)[source]

Control a scatter plot using widgets.

Parameters
  • x, y (function or float or array-like) – shape (n, ) for array-like. Functions must return the correct shape as well. If y is None then parametric must be True and the function for x must return x, y

  • c (array-like or list of colors or color or Callable) – Valid input to plt.scatter or a function

  • s (float, array-like, function, or index controls object) – valid input to plt.scatter, or a function

  • alpha (float, None, or function(s), broadcastable) – Affects all scatter points. This will compound with any alpha introduced by the c argument

  • marker (MarkerStyle, or Callable, optional) – The marker style or a function returning marker styles.

  • edgecolor[s] (callable or valid argument to scatter) – passed through to scatter.

  • facecolor[s] (callable or valid argument to scatter) – Valid input to plt.scatter, or a function

  • label (string) – Passed through to Matplotlib

  • parametric (boolean) – If True then the function expects to have only received a value for y and that that function will return an array for both x and y, or will return an array with shape (N, 2)

  • ax (matplotlib axis, optional) – The axis on which to plot. If none the current axis will be used.

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

  • xlim (string or tuple of floats, optional) – If a tuple it will be passed to ax.set_xlim. Other options are: ‘auto’: rescale the x axis for every redraw ‘stretch’: only ever expand the xlims.

  • ylim (string or tuple of floats, optional) – If a tuple it will be passed to ax.set_ylim. Other options are same as xlim

  • 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 on creation. Ignored if controls is specified.

Returns

controls