maui.visualizations.indices_histogram_plot

maui.visualizations.indices_histogram_plot(df, indices, group_by=None, max_cols=3, fig_size=None, show_plot=True)[source]

Create histogram plots to visualize the distribution of indices in a DataFrame.

This function generates histogram plots to visualize the distribution of one or more indices from a DataFrame. It provides the option to group data by a single category column.

Parameters:
dfpandas.DataFrame

The input DataFrame containing the data.

indiceslist

A list of column names in the DataFrame representing the indices to be plotted.

group_bystr, optional

A column name for grouping data (default is None).

max_colsint, optional

Maximum number of columns for subplots (default is 3).

fig_sizedict, optional

A dictionary specifying the height and width of the plot (default is None).

show_plotbool, optional

Whether to display the plot (default is True).

Returns:
plotly.graph_objs._figure.Figure

A Plotly Figure object representing the histogram plot.

Raises:
AssertionError

If the arguments are not correctly specified.

Exception

If the input data or arguments are invalid.

Notes

  • The ‘group_by’ argument is optional, but if provided, only one index can be plotted.

  • ‘fig_size’ should be a dictionary with ‘height’ and ‘width’ keys.

Examples

>>> from maui import samples, acoustic_indices, visualizations
>>> df = samples.get_leec_audio_sample()
>>> indices_list = ['median_amplitude_envelope', 'temporal_entropy']
>>> df = acoustic_indices.calculate_acoustic_indices(df, indices_list, parallel=False)
>>> fig = visualizations.indices_histogram_plot(df, indices=['m', 'ht'],
group_by=None, max_cols=3)