distribution_plot

distribution_plot#

class braintools.visualize.distribution_plot(data, labels=None, plot_type='hist', bins=30, density=True, fit_normal=False, ax=None, figsize=(10, 6), colors=None, alpha=0.7, xlabel='Value', ylabel='Density', title=None, **kwargs)#

Plot distribution of data with various options.

Parameters:
  • data (ndarray | List[ndarray]) – Data to plot distribution for.

  • labels (List[str] | None) – Labels for each dataset.

  • plot_type (str) – Type of plot: ‘hist’, ‘kde’, ‘both’.

  • bins (int | ndarray) – Number of bins or bin edges for histogram.

  • density (bool) – Whether to normalize histogram.

  • fit_normal (bool) – Whether to overlay normal distribution fit.

  • ax (Axes | None) – Axes to plot on.

  • figsize (Tuple[float, float]) – Figure size if creating new figure.

  • colors (List[str] | None) – Colors for each dataset.

  • alpha (float) – Alpha transparency.

  • xlabel (str) – Axis labels and title.

  • ylabel (str) – Axis labels and title.

  • title (str | None) – Axis labels and title.

  • **kwargs – Additional arguments passed to plotting functions.

Returns:

ax – The axes object containing the plot.

Return type:

Axes