code: def plot_model_results(
      original_data: pd.Series,
      model_results: List[pd.DataFrame],
      model_labels: List[str],
      plot: str,
      fig_defaults: Dict[str, Any],
      hoverinfo: Optional[str] = "text",
      fig_kwargs: Optional[Dict] = None,
  ) -> PlotReturnType:
      """Plots the original target series along with overlaid model results which
      could be out of sample predictions, insample predictions or residuals.
  
      Parameters
      ----------
      original_data : pd.Series
          The original target series to be plotted.
      model_results : List[pd.DataFrame]
          The model results that must be overlaid over the original data. e.g. out
          of sample predictions, insample predictions or residuals from possibly
          multiple models. Each column in the overlay_data is overlaid as a separate
          series over the original_data. The column names are used as labels for the
          overlaid data.
      model_labels : List[str]
          The labels corresponding to the models whose results are being plotted.
      plot : str
          The type of plot.
              "forecast": Out of Sample Forecasts
              "insample": Insample Forecasts
              "residuals": Model Residuals
      fig_defaults : Dict[str, Any]
          The defaults dictionary containing keys for "width", "height", and "template".
      hoverinfo : Optional[str], optional
          Whether to display the hoverinfo in the plot, by default "text"
      fig_kwargs : Optional[Dict], optional
          Specific overrides by the user for the plotly figure settings,
          by default None. Can contain keys for "width", "height" and/or "template".
  
      Returns
      -------
      PlotReturnType
          The plotly figure object along with a dictionary with the plot data.
          The data can be returned to the user (if requested) so that the plot can
          be and customized by them if not supported by pycaret by default.
  
      Raises
      ------
      ValueError
          When model_labels is None
      """
      if model_labels is None:
          raise ValueError(msg2)
  
      model_results, model_labels = _clean_model_results_labels(
          model_results=model_results, model_labels=model_labels
      )
  
      if plot in ["forecast", "insample"]:
          model_results = [
              model_result["y_pred"] for model_result in model_results
          ]
      model_results = pd.concat(model_results, axis=1)
      model_results.columns = model_labels
  
      if plot == "forecast":
          key = "Forecast (Out-of-Sample)"
      elif plot == "insample":
          key = "Forecast (In-Sample)"
      elif plot == "residuals":
          key = "Residuals"
      title = f"Actual vs. {key}"
  
      fig, return_data_dict = plot_original_with_overlays(
          original_data=original_data,
          overlay_data=model_results,
          title=title,
          fig_defaults=fig_defaults,
          hoverinfo=hoverinfo,
          fig_kwargs=fig_kwargs,
      )
  
      return fig, return_data_dict
  
file_path: pycaret/pycaret/internal/plots/time_series.py
imports: from typing import Any, Dict, List, Optional, Union
  import numpy
  import pandas
  import plotly.graph_objects
  from plotly.subplots import make_subplots
  from sktime.forecasting.model_selection import ExpandingWindowSplitter, SlidingWindowSplitter
  from pycaret.internal.plots.utils.time_series import PlotReturnType, _clean_model_results_labels, _get_subplot_rows_cols, _plot_fig_update, _resolve_hoverinfo, _update_fig_dimensions, corr_subplot, decomp_subplot, dist_subplot, frequency_components_subplot, plot_original_with_overlays, qq_subplot, time_series_subplot
  from pycaret.utils.generic import _resolve_dict_keys
  from pycaret.utils.time_series import get_diffs
label_desc: Use image node_id 5 for calling a global function with example usage: plot_model_results(original_data, model_results, model_labels, plot, fig_defaults, hoverinfo, fig_kwargs) and returns: fig,  return_data_dict