maui.visualizations.indices_violin_plot

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

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

This function generates violin 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).

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 violin 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 and allows grouping data by a single category column.

  • ‘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_violin_plot(df, indices=['m', 'ht'], group_by=None)