diagnostic.visualizations.plot_metric_ranking#
- plot_metric_ranking(df_metric, ax=None, plot_colorbar=True, hex_color1=None, hex_color2=None, **kwargs)[source]#
Plots a heatmap of the ranking of metrics for different model members.
This function takes a DataFrame of metrics, calculates the rankings of these metrics for each model member, and creates a heatmap representing the ranks. The plot can optionally include a colorbar to represent the ranking levels. If no axis is provided, a new figure and axis are created for the plot.
Parameters:#
- df_metricpd.DataFrame
A DataFrame containing the calculated metrics for different model members. Each column represents a model member, and each row represents a metric.
- axmatplotlib.axes.Axes, optional
A pre-existing axis to plot the heatmap. If None (default), a new figure and axis are created.
- plot_colorbarbool, optional
If True (default), a colorbar is added to the plot to represent the rank levels. If False, the heatmap is plotted without a colorbar.
- hex_color1str
The starting color of the colormap in hex format (e.g., ‘#FF0000’ for red).
- hex_color2str
The ending color of the colormap in hex format (e.g., ‘#0000FF’ for blue).
Returns:#
- axmatplotlib.axes.Axes
The axis object containing the heatmap plot.
Notes:#
The color map has the ‘summer’ palette as default and is resampled to the number of model members.
A customized color map can be included or determined as an interpolation between two colorcodes (hex codes)
Rankings are normalized based on the number of model members.
The function supports colorbar ticks to represent custom rank labels, which are added only if plot_colorbar=True.