WrightTools.artists.interact2D

WrightTools.artists.interact2D(data: Data, xaxis=0, yaxis=1, channel=0, cmap=None, local=False, use_imshow=False, verbose=True)[source]

Interactive 2D plot of the dataset. Side plots show x and y projections of the slice (shaded gray). Left clicks on the main axes draw 1D slices on side plots at the coordinates selected. Right clicks remove the 1D slices. For 3+ dimensional data, sliders below the main axes are used to change which slice is viewed.

Parameters:
  • data (WrightTools.Data object) – Data to plot.

  • xaxis (string, integer, or data.Axis object (optional)) – Expression or index of x axis. Default is 0.

  • yaxis (string, integer, or data.Axis object (optional)) – Expression or index of y axis. Default is 1.

  • channel (string, integer, or data.Channel object (optional)) – Name or index of channel to plot. Default is 0.

  • cmap (string or cm object (optional)) – Name of colormap, or explicit colormap object. Defaults to channel default.

  • local (boolean (optional)) – Toggle plotting locally. Default is False.

  • use_imshow (boolean (optional)) – If True, matplotlib imshow is used to render the 2D slice. Can give better performance, but is only accurate for uniform grids. Default is False.

  • verbose (boolean (optional)) – Toggle talkback. Default is True.

Returns:

  • out (types.SimpleNamespace) – container for important interactive elements of the plot.

    image2D artist object

    The artist of the 2D plot. Type is either matplotlib.collections.QuadMesh (use_imshow=False) or matplotlib.image.AxesImage (use_imshow=True)

    slidersdict (key[name] = value[matplotlib.Widgets.Slider])

    The sliders.

    crosshairs: list of horizontal and vertical crosshair

    crosshairs are lists of matplotlib.lines.Line2D

    radiomatplotlib.Widgets.RadioButtons

    radio button for local/global normalization

    colorbarmatplotlib.colorbar.ColorbarBase

    The 2D colorbar object

  • Usage

  • —–

  • When calling, always store the returned arguments to a variable

  • >>> out = WrightTools.artists.interact2D(…)

  • This prevents interactive buttons from turning off due to python’s garbage collection.