scallops.visualize.histogram.channel_hist_plot

scallops.visualize.histogram.channel_hist_plot(image, binrange=None, bins='auto', height=5, aspect=1, **kwargs)

Plot histogram per image/channel.

Parameters:
  • height (float) – Height (in inches) of each facet.

  • aspect (float) – Aspect ratio of each facet, so that aspect * height gives the width of each facet in inches

  • image (Experiment | DataArray) – XArray with the dimensions (t,c,z,y,c) or (i,t,c,z,y,c)

  • binrange (tuple[float, float]) – Lowest and highest value for bin edges. Defaults to data extremes.

  • bins (str | int | Sequence[float]) – Generic bin parameter that can be the name of a reference rule, the number of bins, or the breaks of the bins. Passed to numpy.histogram_bin_edges()

  • kwargs (dict) – Additional keyword arguments to pass to matplotlib.pyplot.hist()

Returns:

The matplotlib axes containing the plot.

Example:
import numpy as np
import xarray as xr
from scallops.visualize import channel_hist_plot

# Generate synthetic data
data = np.random.normal(size=(10, 3, 64, 64))
image = xr.DataArray(data, dims=("t", "c", "y", "x"))

# Plot histogram
channel_hist_plot(image, binrange=(-3, 3), bins=50, height=8, aspect=2)
plt.show()
Return type:

Axes