autoemulate.core.plotting

autoemulate.core.plotting#

display_figure(fig)[source]#

Display a matplotlib figure.

Display a matplotlib figure appropriately based on the environment (Jupyter notebook or terminal).

Parameters:

fig (Figure) – The object to display.

Returns:

The input figure object.

Return type:

Figure

plot_xy(x, y, y_pred, y_variance=None, ax=None, title='xy', input_index=None, output_index=None, r2_score=None)[source]#

Plot observed and predicted values vs. features.

Parameters:
  • x (NumpyLike) – An array of inputs.

  • y (NumpyLike) – An array of outputs.

  • y_pred (NumpyLike) – An array of predictions.

  • y_variance (NumpyLike | None) – An optional array of predictive variances.

  • ax (Axes | None) – An optional matplotlib Axes object to plot on.

  • title (str) – An optional title for the plot.

  • input_index (int | None) – An optional index of the input dimension to plot.

  • output_index (int | None) – An optional index of the output dimension to plot.

  • r2_score (float | None) – An option r2 score to include in the plot legend.

calculate_subplot_layout(n_plots, n_cols=3)[source]#

Calculate optimal number of rows and columns for subplots.

Parameters:
  • n_plots (int) – Number of plots to display.

  • n_cols (int) – Maximum number of columns allowed. Defaults to 3.

Returns:

(n_rows, n_cols) for the subplot layout.

Return type:

tuple