code: def plot_classification_report(
      classification_report,
      title="Classification report ",
      cmap="RdBu",
      from_conll_json=False,
  ):
      """
      Plot scikit-learn classification report.
      Extension based on http://stackoverflow.com/a/31689645/395857
      """
      classes = []
      plotMat = []
      support = []
      class_names = []
      if from_conll_json:
          for label in sorted(classification_report.keys()):
              support.append(classification_report[label]["support"])
              classes.append("micro-avg" if label == "all" else label)
              class_names.append(
                  "micro-avg" if label == "all" else label
              )
              plotMat.append(
                  [
                      float(classification_report[label][x])
                      for x in ["precision", "recall", "f1"]
                  ]
              )
      else:
          lines = classification_report.split("\n")
          for line in lines[2 : (len(lines) - 1)]:
              t = line.strip().replace(" avg", "-avg").split()
              if len(t) < 2:
                  continue
              classes.append(t[0])
              v = [float(x) * 100 for x in t[1 : len(t) - 1]]
              support.append(int(t[-1]))
              class_names.append(t[0])
              plotMat.append(v)
  
      xlabel = "Metrics"
      ylabel = "Classes"
      xticklabels = ["Precision", "Recall", "F1-score"]
      yticklabels = [
          "{0} ({1})".format(class_names[idx], sup)
          for idx, sup in enumerate(support)
      ]
      figure_width = 25
      figure_height = len(class_names) + 7
      correct_orientation = True
  
      heatmap(
          np.array(plotMat),
          title,
          xlabel,
          ylabel,
          xticklabels,
          yticklabels,
          figure_width,
          figure_height,
          correct_orientation,
          cmap=cmap,
      )
  
file_path: NeuroNER/neuroner/utils_plots.py
imports: from __future__ import print_function
  from __future__ import division
  import matplotlib
  from matplotlib import cm
  import matplotlib.pyplot
  import numpy
  import sklearn.preprocessing
label_desc: Use image node_id 5 for calling a global function with example usage: plot_classification_report(classification_report, title, cmap, from_conll_json) without return types