code: def plot_frequency_components(
      data: pd.Series,
      plot: str,
      fig_defaults: Dict[str, Any],
      data_label: Optional[str] = None,
      model_labels: Optional[List[str]] = None,
      hoverinfo: Optional[str] = "text",
      fig_kwargs: Optional[Dict] = None,
  ) -> PlotReturnType:
      """Plots the frequency components for the data provided (could be any data
      type of the data - original, imputed, transformed) or model residuals.
  
      Parameters
      ----------
      data : pd.Series
          Data whose frequency components needs to be plotted. If based on the original
          data, it can contain multiple columns corresponding to the various data
          types of the targets (original, imputed, transformed). If it is based on
          a estimator(s), it can contain residuals from multiple models (one column
          per model). The column names must correspond to the model labels in this
          case.
      plot : str
          Type of plot, allowed values are ["periodogram", "fft", "welch"]
      fig_defaults : Dict[str, Any]
          The default settings for the plotly plot. Must contain keys for "width",
          "height", and "template".
      data_label : Optional[str], optional
          If data is from the original target series, then the name of the target
          series, by default None.
      model_labels : Optional[List[str]], optional
          If data is from model residuals, then the name(s) of the model(s),
          by default None. At least one of data_label or model_labels must be provided.
      hoverinfo : Optional[str], optional
          Action when hovering over the plotly 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
          (1) When the plot type is not supported.
          (2) When both data_label and model_labels are None
      """
      fig_kwargs = fig_kwargs or {}
  
      ncols = len(data.columns)
      fig = make_subplots(
          rows=1,
          cols=ncols,
          column_titles=data.columns.tolist(),
          shared_yaxes=True,
      )
  
      all_plot_data = {}
      for i, col_name in enumerate(data.columns):
          fig, plot_data = frequency_components_subplot(
              fig=fig,
              data=data[col_name],
              row=1,
              col=i + 1,
              plot=plot,
              hoverinfo=hoverinfo,
          )
          all_plot_data.update({col_name: plot_data})
  
      if plot == "periodogram":
          title = "Periodogram"
      elif plot == "fft":
          title = "FFT"
      elif plot == "welch":
          title = "Welch"
      else:
          raise ValueError(
              f"Plot '{plot}' is not supported by plot_frequency_components()."
          )
  
      if model_labels is not None:
          title = f"{title} | Model Residuals"
      elif data_label is not None:
          title = f"{title} | {data_label}"
      else:
          # Both model_labels and data_label are None
          raise ValueError(msg1)
  
      with fig.batch_update():
          for i in np.arange(1, ncols + 1):
              fig.update_xaxes(title_text="Frequency", row=1, col=i)
  
          # Only on first column
          fig.update_yaxes(title_text="dB", row=1, col=1)
          template = _resolve_dict_keys(
              dict_=fig_kwargs, key="template", defaults=fig_defaults
          )
          fig.update_layout(
              title=title, showlegend=False, template=template
          )
          fig.update_traces(marker={"size": 10})
          fig = _update_fig_dimensions(
              fig=fig, fig_kwargs=fig_kwargs, fig_defaults=fig_defaults
          )
  
      return_data_dict = {plot: all_plot_data}
  
      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 10 for calling a global function with example usage: plot_frequency_components(data, plot, fig_defaults, data_label, model_labels, hoverinfo, fig_kwargs) and returns: fig,  return_data_dict