maui.visualizations.indices_radar_plot¶
- maui.visualizations.indices_radar_plot(df, indices, agg_type, group_by=None, max_cols=3, fig_size=None, show_plot=True)[source]¶
Create a radar plot to compare indices in a DataFrame.
This function generates a radar plot to compare multiple indices from a DataFrame. It allows aggregating data based on specified aggregation types and grouping by one or two columns from the DataFrame.
- Parameters:
- dfpandas.DataFrame
The input DataFrame containing the data.
- indiceslist
A list of column names in the DataFrame representing the indices to be compared.
- agg_typestr
The type of aggregation to be applied (‘mean’, ‘median’, ‘stddev’, ‘var’, ‘max’, ‘min’).
- group_bylist, optional
A list of one or two column names 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 radar plot.
- Raises:
- AssertionError
If the arguments are not correctly specified.
- Exception
If the input data or arguments are invalid.
Notes
The ‘agg_type’ argument must be one of [‘mean’, ‘median’, ‘stddev’, ‘var’, ‘max’, ‘min’].
The ‘group_by’ argument can contain one or two columns for grouping data.
‘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_radar_plot(df, indices=['m', 'ht'], agg_type='mean', group_by=['environment'], max_cols=3) # Generates a radar plot comparing 'Index1' and 'Index2' aggregated by 'Category'.