code: def plot_density(
      data_dict,
      title="",
      xtitle="",
      ytitle="",
      is_categorical=False,
      name="",
      color=COLORS[0],
  ):
      counts = data_dict["scores"]
      edges = data_dict["names"]
      data = []
      if not is_categorical:
          x_text = []
          for indx in range(len(edges) - 1):
              new_val = "{0} - {1}".format(
                  _pretty_number(edges[indx]),
                  _pretty_number(edges[indx + 1]),
              )
              x_text.append(new_val)
          x_vals = [np.mean([i, j]) for i, j in zip(edges, edges[1:])]
      else:
          x_vals = edges
          x_text = edges
  
      data.append(
          go.Bar(
              x=x_vals,
              y=counts,
              hovertemplate="(%{hovertext}): %{y}",
              hovertext=x_text,
              name=name,
              marker=dict(color=color),
          )
      )
      layout = go.Layout(
          title=title,
          showlegend=False,
          xaxis=dict(title=xtitle),
          yaxis=dict(title=ytitle),
          hovermode="closest",
      )
      if not is_categorical:
          layout["xaxis"] = dict(
              title=xtitle,
              tickmode="array",
              tickvals=x_vals,
              ticktext=x_text,
          )
      bar_fig = go.Figure(data, layout)
      return bar_fig
  
imports: import plotly.graph_objs
  import numpy
  from plotly import subplots
  import matplotlib.pyplot
  from numbers import Number
  import logging
label_desc: Use image node_id 7 for calling a global function with example usage: plot_density(data_dict, title, xtitle, ytitle, is_categorical, name, color) and returns: bar_fig