code: def _add_stats_box(h1: Histogram1D, ax: Axes, stats: Union[str, bool] = "all"):
      
  
      # place a text box in upper left in axes coords
      if stats in ["all", True]:
          text = "Total: {0}\nMean: {1:.2f}\nStd.dev: {2:.2f}".format(
              h1.total, h1.mean(), h1.std())
      elif stats == "total":
          text = "Total: {0}".format(h1.total)
      else:
          raise ValueError("Invalid stats specification")
          
      ax.text(0.05, 0.95, text, transform=ax.transAxes,
              verticalalignment='top', horizontalalignment='left')
docs: Insert a small legend-like box with statistical information.
  
      Parameters
      ----------
      stats : "all" | "total" | True
          What info to display
  
      Note
      ----
      Very basic implementation.