code: def plot_trend(
      m, quantile, plot_name="Trend Change", df_name="__df__"
  ):
      """Make a barplot of the magnitudes of trend-changes.
  
      Parameters
      ----------
          m : NeuralProphet
              Fitted model
          quantile : float
              The quantile for which the yearly seasonality is plotted
          plot_name : str
              Name of the plot Title
          df_name : str
              Name of dataframe to refer to data params from original keys of train dataframes
  
              Note
              ----
              Only used for local normalization in global modeling
  
      Returns
      -------
          Dictionary with plotly traces, xaxis and yaxis
      """
      traces = []
      line_width = 2
  
      if m.config_trend.n_changepoints == 0:
          if isinstance(df_name, list):
              df_name = df_name[0]
          data_params = m.config_normalization.get_data_params(df_name)
          t_start = data_params["ds"].shift
          t_end = t_start + data_params["ds"].scale
          quantile_index = m.model.quantiles.index(quantile)
  
          fcst_t = pd.Series([t_start, t_end]).dt.to_pydatetime()
          trend_0 = (
              m.model.trend.bias[quantile_index]
              .detach()
              .numpy()
              .squeeze()
              .reshape(1)
          )
          if m.config_trend.growth == "off":
              trend_1 = trend_0
          else:
              if m.model.config_trend.trend_global_local == "local":
                  trend_1 = (
                      trend_0
                      + m.model.trend.trend_k0[
                          quantile_index, m.model.id_dict[df_name]
                      ]
                      .detach()
                      .numpy()
                  )
              else:
                  trend_1 = (
                      trend_0
                      + m.model.trend.trend_k0[quantile_index, 0]
                      .detach()
                      .numpy()
                  )
  
          data_params = m.config_normalization.get_data_params(df_name)
          shift = data_params["y"].shift
          scale = data_params["y"].scale
          trend_0 = trend_0 * scale + shift
          trend_1 = trend_1 * scale + shift
  
          traces.append(
              go.Scatter(
                  name=plot_name,
                  x=fcst_t,
                  y=np.concatenate([trend_0, trend_1]),
                  mode="lines",
                  line=dict(color=color, width=line_width),
                  fill="none",
              )
          )
          extended_daterange = pd.date_range(
              start=fcst_t[0].strftime("%Y-%m-%d"),
              end=fcst_t[1].strftime("%Y-%m-%d"),
          ).to_pydatetime()
          padded_range = get_dynamic_axis_range(
              extended_daterange, type="dt"
          )
      else:
          mean_std = True
          if not isinstance(df_name, list):
              df_name = [df_name]
              # if global df with no specified df_name: plot mean and std, otherwise: don't
              mean_std = False
          df_y = pd.DataFrame()
          for df_name_i in df_name:
              data_params = m.config_normalization.get_data_params(
                  df_name_i
              )
              t_start = data_params["ds"].shift
              t_end = t_start + data_params["ds"].scale
              quantile_index = m.model.quantiles.index(quantile)
  
              days = pd.date_range(
                  start=t_start, end=t_end, freq=m.data_freq
              )
              df_i = pd.DataFrame({"ds": days})
              df_i["ID"] = df_name_i
              df_y = pd.concat((df_y, df_i), ignore_index=True)
  
          df_trend = m.predict_trend(df=df_y, quantile=quantile)
          if mean_std:
              df_trend_q90 = df_trend.groupby("ds")[["trend"]].apply(
                  lambda x: x.quantile(0.9)
              )
              df_trend_q10 = df_trend.groupby("ds")[["trend"]].apply(
                  lambda x: x.quantile(0.1)
              )
              df_trend = df_trend.groupby("ds")[["trend"]].apply(
                  lambda x: x.mean()
              )
              df_trend["ID"] = m.id_list[0]
              df_y = df_y[df_y["ID"] == m.id_list[0]]
  
          traces.append(
              go.Scatter(
                  name=plot_name + " mean" if mean_std else plot_name,
                  x=df_y["ds"].dt.to_pydatetime(),
                  y=df_trend["trend"],
                  mode="lines",
                  line=dict(color=color, width=line_width),
                  fill="none",
              )
          )
          if mean_std:
              # If more than on ID has been provided, and no df_name has been specified: plot mean and quants of the
              # component
              filling = "tonexty"
              traces.append(
                  go.Scatter(
                      name="Quants: 10%",
                      x=df_y["ds"].dt.to_pydatetime(),
                      y=df_trend_q10["trend"],
                      mode="lines",
                      line=dict(
                          color="rgba(45, 146, 255, 0.2)", width=1
                      ),
                      fillcolor="rgba(45, 146, 255, 0.2)",
                      showlegend=True,
                  )
              )
              traces.append(
                  go.Scatter(
                      name="Quants: 90%",
                      x=df_y["ds"].dt.to_pydatetime(),
                      y=df_trend_q90["trend"],
                      fill=filling,
                      mode="lines",
                      line=dict(
                          color="rgba(45, 146, 255, 0.2)", width=1
                      ),
                      fillcolor="rgba(45, 146, 255, 0.2)",
                      showlegend=True,
                  )
              )
          padded_range = get_dynamic_axis_range(
              df_y["ds"].dt.to_pydatetime(), type="dt"
          )
  
      xaxis = go.layout.XAxis(
          title="ds",
          type="date",
          range=padded_range,
      )
      yaxis = go.layout.YAxis(
          rangemode="normal",
          title=go.layout.yaxis.Title(text=plot_name),
      )
  
      return {"traces": traces, "xaxis": xaxis, "yaxis": yaxis}
  
file_path: neural_prophet/neuralprophet/plot_model_parameters_plotly.py
imports: import datetime
  import logging
  import numpy
  import pandas
  from neuralprophet.plot_utils import predict_one_season, predict_season_from_dates
label_desc: Use image node_id 3 for calling a global function with example usage: plot_trend(m, quantile, plot_name, df_name) and returns: dict