code: def plot_scalar_weights(
      weights, plot_name, focus=None, multiplicative=False
  ):
      """Make a barplot of the regressor weights.
  
      Parameters
      ----------
          weights : list
              tuples of (name, weights)
          plot_name : str
              Name of the plot Title
          focus : int
              Show weights for this forecast, if provided
          multiplicative : bool
              Flag to set y axis as percentage
  
      Returns
      -------
          Dictionary with Plotly traces, xaxis and yaxis
      """
      traces = []
  
      names = []
      values = []
      for name, weights in weights:
          names.append(name)
          weight = np.squeeze(weights)
          if len(weight.shape) > 1:
              raise ValueError("Not scalar " + plot_name)
          if len(weight.shape) == 1 and len(weight) > 1:
              if focus is not None:
                  weight = weight[focus - 1]
              else:
                  weight = np.mean(weight)
          values.append(weight)
  
      traces.append(
          go.Bar(
              name=plot_name,
              x=np.array(names),
              y=values,
              marker_color=color,
              width=0.8,
          )
      )
  
      xaxis = go.layout.XAxis(title=f"{plot_name} name")
  
      if "lagged" in plot_name.lower():
          if focus is None:
              yaxis = go.layout.YAxis(
                  rangemode="normal",
                  title=go.layout.yaxis.Title(
                      text=f"{plot_name} weight (avg)"
                  ),
              )
          else:
              yaxis = go.layout.YAxis(
                  rangemode="normal",
                  title=go.layout.yaxis.Title(
                      text=f"{plot_name} weight ({focus})-ahead"
                  ),
              )
      else:
          yaxis = go.layout.YAxis(
              rangemode="normal",
              title=go.layout.yaxis.Title(text=f"{plot_name} weight"),
          )
  
      if multiplicative:
          yaxis.update(tickformat=".1%", hoverformat=".4%")
  
      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 4 for calling a global function with example usage: plot_scalar_weights(weights, plot_name, focus, multiplicative) and returns: dict