code: def plot_components(
      m,
      fcst,
      plot_configuration,
      df_name="__df__",
      one_period_per_season=False,
      figsize=(700, 210),
      resampler_active=False,
      plotly_static=False,
  ):
      """
      Plot the NeuralProphet forecast components.
  
      Parameters
      ----------
          m : NeuralProphet
              Fitted model
          fcst : pd.DataFrame
              Output of m.predict
          plot_configuration: dict
              dict of configured components to plot
          df_name : str
              ID from time series that should be plotted
          one_period_per_season : bool
              Plot one period per season, instead of the true seasonal components of the forecast.
          figsize : tuple
              Width, height in inches.
          resampler_active : bool
              Flag whether to activate the plotly-resampler
          plotly_static: bool
              Flag whether to generate a static svg image
  
      Returns
      -------
          Plotly figure
      """
      log.debug("Plotting forecast components")
      if resampler_active:
          register_plotly_resampler(mode="auto")
      else:
          unregister_plotly_resampler()
      fcst = fcst.fillna(value=np.nan)
      components_to_plot = plot_configuration["components_list"]
  
      # set number of axes based on selected plot_names and sort them according to order in components
      panel_names = list(
          set(
              next(iter(dic.values())).lower()
              for dic in components_to_plot
          )
      )
      panel_order = [
          x
          for dic in components_to_plot
          for x in panel_names
          if x in dic["plot_name"].lower()
      ]
      npanel = len(panel_names)
      figsize = figsize if figsize else (700, 210 * npanel)
  
      # Create Plotly subplot figure and add the components to it
      fig = make_subplots(npanel, cols=1, print_grid=False)
      fig.update_layout(
          go.Layout(
              # showlegend=False, #set individually instead
              width=figsize[0],
              height=figsize[1] * npanel,
              **layout_args,
          )
      )
  
      multiplicative_axes = []
      for comp in components_to_plot:
          name = comp["plot_name"].lower()
          j = panel_order.index(name)
  
          if (
              name in ["trend"]
              or ("ar" in name and "ahead" in name)
              or ("lagged_regressor" in name and "ahead" in name)
              or ("uncertainty" in name)
          ):
              trace_object = get_forecast_component_props(
                  fcst=fcst, df_name=df_name, **comp
              )
  
          elif "event" in name or "future regressor" in name:
              trace_object = get_forecast_component_props(
                  fcst=fcst, df_name=df_name, **comp
              )
  
          elif "season" in name:
              if m.config_seasonality.mode == "multiplicative":
                  comp.update({"multiplicative": True})
              if one_period_per_season:
                  comp_name = comp["comp_name"]
                  trace_object = get_seasonality_props(
                      m, fcst, df_name, **comp
                  )
              else:
                  comp_name = f"season_{comp['comp_name']}"
                  trace_object = get_forecast_component_props(
                      fcst=fcst,
                      df_name=df_name,
                      comp_name=comp_name,
                      plot_name=comp["plot_name"],
                  )
  
          elif "auto-regression" in name or "lagged regressor" in name:
              trace_object = get_multiforecast_component_props(
                  fcst=fcst, **comp
              )
              fig.update_layout(barmode="overlay")
  
          if j == 0:
              xaxis = fig["layout"]["xaxis"]
              yaxis = fig["layout"]["yaxis"]
          else:
              xaxis = fig["layout"][f"xaxis{j + 1}"]
              yaxis = fig["layout"][f"yaxis{j + 1}"]
  
          xaxis.update(trace_object["xaxis"])
          xaxis.update(**xaxis_args)
          yaxis.update(trace_object["yaxis"])
          yaxis.update(**yaxis_args)
          for trace in trace_object["traces"]:
              fig.add_trace(
                  trace, row=j + 1, col=1
              )  # adapt var name to plotly-resampler
          fig.update_layout(legend={"y": 0.1, "traceorder": "reversed"})
  
      # Reset multiplicative axes labels after tight_layout adjustment
      for ax in multiplicative_axes:
          ax = set_y_as_percent(ax)
      unregister_plotly_resampler()
      if plotly_static:
          fig = fig.show("svg")
      return fig
  
file_path: neural_prophet/neuralprophet/plot_forecast_plotly.py
imports: import logging
  import numpy
  import pandas
  from neuralprophet.plot_model_parameters_plotly import get_dynamic_axis_range
  from neuralprophet.plot_utils import set_y_as_percent
label_desc: Use image node_id 2 for calling a global function with example usage: plot_components(m, fcst, plot_configuration, df_name, one_period_per_season, figsize, resampler_active, plotly_static) and returns: fig