code: def plot_timeseries(
      ts,
      color: Union[str, dict] = "green",
      fig=None,
      name="time series",
  ):
      showlegend = True
      if type(ts) == dict:
          data = ts
          if type(color) == str:
              color = {k: color for k in data}
      elif type(ts) == list:
          data = {}
          for k, ts_data in enumerate(ts):
              data[k] = ts_data
          if type(color) == str:
              color = {k: color for k in data}
      else:
          data = {}
          data["default"] = ts
          color = {"default": color}
  
      if fig is None:
          fig = go.Figure()
  
      first = True
      for key, ts in data.items():
          if not first:
              showlegend = False
  
          add_timeseries(
              fig,
              ts,
              color=color[key],
              showlegend=showlegend,
              name=name,
          )
          first = False
  
      return fig
  
file_path: AIX360/examples/tsice/plots.py
imports: from typing import Union
  import numpy
  import pandas
  from sklearn.linear_model import LinearRegression
label_desc: Use image node_id 2 for calling a global function with example usage: plot_timeseries(ts, color, fig, name) and returns: fig