Plotting Utilities

This module contains a series of utilities for creating two dimensional plots that are useful for generating documentation and vignettes. We suggest that users leverage starfish.display() for their plotting needs, as the interactive viewer is better able to handle the array of features that starfish needs.

from starfish.util import plot
starfish.util.plot.diagnose_registration(imagestack, *sels, ax=None, title=None, **kwargs)[source]

Overlays 2-d images extracted from ImageStack for the purpose of visualizing alignment of images from different rounds or channels selected with the sel parameter. Up to six images can be selected and shown in different colors. The same Axes.X and Axes.Y indices should be used for every Selector.

Parameters
imagestackImageStack

imagestack from which to extract 2-d images for plotting

*selsOptional[Mapping[Axes, Union[int, tuple]]]

Optional, but only if image_stack is already of shape (1, 1, 1, y, x). Selectors to pass ImageStack.sel, Selects the (y, x) planes to be plotted.

ax :

Axes to plot on. If not passed, defaults to the current axes.

titleOptional[str]

Title to assign the Axes being plotted on.

kwargs :

additional keyword arguments to pass to imshow_plane

starfish.util.plot.imshow_plane(image_stack, sel=None, ax=None, title=None, **kwargs)[source]

Plot a single plane of an ImageStack. If passed a selection function (sel), the stack will be subset using ImageStack.sel(). If ax is passed, the function will be plotted in the provided axis. Additional kwargs are passed to plt.imshow()

Parameters
image_stackImageStack

imagestack from which to extract a 2-d image for plotting

selOptional[Mapping[Axes, Union[int, tuple]]]

Optional, but only if image_stack is already of shape (1, 1, 1, y, x). Selector to pass ImageStack.sel, Selects the (y, x) plane to be plotted.

ax :

Axes to plot on. If not passed, defaults to the current axes.

titleOptional[str]

Title to assign the Axes being plotted on.

kwargs :

additional keyword arguments to pass to plt.imshow

Return type

None

starfish.util.plot.intensity_histogram(image_stack, sel=None, ax=None, title=None, **kwargs)[source]

Plot the 1-d intensity histogram of linearized image_stack.

Parameters
image_stackImageStack

imagestack containing intensities

selOptional[Mapping[Axes, Union[int, tuple]]]

Optional, Selector to pass ImageStack.sel that will restrict the histogram construction to the specified subset of image_stack.

ax :

Axes to plot on. If not passed, defaults to the current axes.

titleOptional[str]

Title to assign the Axes being plotted on.

kwargs :

additional keyword arguments to pass to plt.hist

Return type

None

starfish.util.plot.overlay_spot_calls(image_stack, intensities, sel=None, ax=None, title=None, imshow_kwargs=None, scatter_kwargs=None)[source]

Overlays spot calls atop a 2-d image extracted from ImageStack. Manages sub-selection from the IntensityTable and ImageStack based on provided sel parameter.

Parameters
image_stackImageStack

imagestack from which to extract a 2-d image for plotting

intensitiesIntensityTable

contains spots to overlay on ImageStack.

selOptional[Mapping[Axes, Union[int, tuple]]]

Optional, but only if image_stack is already of shape (1, 1, 1, y, x). Selector to pass ImageStack.sel, Selects the (y, x) plane to be plotted. Will also be used to reduce the spots from intensities.

ax :

Axes to plot on. If not passed, defaults to the current axes.

titleOptional[str]

Title to assign the Axes being plotted on.

imshow_kwargsOptional[Mapping[str, Any]]

additional keyword arguments to pass to imshow

scatter_kwargsOptional[Mapping[str, Any]]

additional keyword arguments to pass to scatter

Return type

None