ESMBenchmarkViz.portrait_plot

ESMBenchmarkViz.portrait_plot(data, xaxis_labels, yaxis_labels, width=600, height=600, annotate=False, annotate_data=None, vrange=None, xaxis_fontsize=None, yaxis_fontsize=None, xaxis_fontstyle=None, yaxis_fontstyle=None, xaxis_location='above', xaxis_rotation=45, title=None, cmap='RdBu_r', cmap_bounds=None, cbar_place='right', cbar_tick_fontsize=None, invert_yaxis=True, clickable=False, line_color='grey', legend_name='Group', legend_labels=None, img_url=None, tooltips=None, url_open=None, missing_color='grey', aspect_scale=1, show_plot=True, bokeh_toolbar=True, bokeh_logo=True, debug=False)[source]

Generates an interactive portrait plot using Bokeh.

Parameters:
  • data (numpy.ndarray or list of numpy.ndarray) – A 2D array, a list of 2D arrays, or a 3D array (stacked 2D arrays) containing the data to plot.

  • xaxis_labels (list of str) – Labels for the x-axis. The number of labels must match the x-axis dimensions, or use an empty list to disable labels.

  • yaxis_labels (list of str) – Labels for the y-axis. The number of labels must match the y-axis dimensions, or use an empty list to disable labels.

  • width (int, optional) – Width of the plot in pixels. Default is 600. If ‘auto’, the width is calculated based on the data size.

  • height (int, optional) – Height of the plot in pixels. Default is 600. If ‘auto’, the height is calculated based on the data size.

  • annotate (bool, optional) – If True, adds annotations to the plot (only for heatmap-style plots). Default is False.

  • annotate_data (numpy.ndarray, optional) – A 2D array to use for annotations. If None, data is used. Default is None.

  • vrange (tuple of float, optional) – Range of values for the color scale. Default is None.

  • xaxis_fontsize (int, optional) – Font size for the x-axis tick labels. Default is None.

  • yaxis_fontsize (int, optional) – Font size for the y-axis tick labels. Default is None.

  • xaxis_fontstyle (str, optional) – Font style for the x-axis labels. Options are [‘normal’, ‘italic’, ‘bold’, ‘bold italic’]. Default is None.

  • yaxis_fontstyle (str, optional) – Font style for the y-axis labels. Options are [‘normal’, ‘italic’, ‘bold’, ‘bold italic’]. Default is None.

  • xaxis_location (str, optional) – Location of the x-axis. Options are [‘above’, ‘below’, ‘both’]. Default is ‘above’.

  • xaxis_rotation (int, optional) – Rotation angle of the x-axis tick labels in degrees. Default is 45.

  • title (str, optional) – Title of the figure. Default is None.

  • cmap (str, optional) – Name of the matplotlib colormap to use. Default is ‘RdBu_r’.

  • cmap_bounds (list of float, optional) – If specified, applies discrete color bins. Default is None.

  • cbar_place (str, optional) – Location of the colorbar. Options are [‘left’, ‘right’, ‘above’, ‘below’, ‘center’]. Default is ‘right’.

  • cbar_tick_fontsize (int, optional) – Font size for the colorbar tick labels. Default is None.

  • invert_yaxis (bool, optional) – If True, places y=0 at the top of the plot. Default is True.

  • clickable (bool, optional) – If True, enables clickable functionality. Default is False.

  • line_color (str, optional) – Color of the lines in the plot. Default is ‘grey’.

  • legend_name (str, optional) – Name of the legend (used for triangular plots). Default is ‘Group’.

  • legend_labels (list of str, optional) – Labels for the legend (used for triangular plots). Default is None.

  • img_url (list of str, optional) – Links to images displayed in tooltips. Default is None.

  • tooltips (str or list of tuple, optional) – Tooltips for the plot. Default is None.

  • url_open (list of str, optional) – Links to open when a tooltip is clicked. Default is None.

  • missing_color (str, optional) – Color for missing values in the plot. Default is ‘grey’.

  • aspect_scale (float, optional) – Scale factor for the plot aspect ratio. Default is 1.

  • show_plot (bool, optional) – If True, the plot will be displayed in the workflow (default is True).

  • bokeh_toolbar (bool, optional) – If True, displays the Bokeh toolbar in the plot. Default is True.

  • bokeh_logo (bool, optional) – If True, displays the Bokeh logo in the plot. Default is True.

  • debug (bool, optional) – If True, prints debug messages. Default is False.

Returns:

plot (Bokeh component) – A Bokeh plot object representing the interactive portrait plot.

Example

>>> from ESMBenchmarkViz import portrait_plot

Notes

  • The function supports both 2D and stacked 3D data for generating portrait plots.

  • Interactive features include tooltips and clickable URLs, enabled through Bokeh.

  • Missing values are displayed using the specified missing_color.