class_docstr: Object returned by explainers.
docstr: Returns the explanation as a pyplot figure.
  
  Will throw an error if you don't have matplotlib installed
  Args:
      label: desired label. If you ask for a label for which an
             explanation wasn't computed, will throw an exception.
             Will be ignored for regression explanations.
      figsize: desired size of pyplot in tuple format, defaults to (4,4).
      kwargs: keyword arguments, passed to domain_mapper
  
  Returns:
      pyplot figure (barchart).
docstr_tok: ["Returns","the","explanation","as","a","pyplot","figure",".","Will","throw","an","error","if","you","do","n't","have","matplotlib","installed","Args",":","label",":","desired","label",".","If","you","ask","for","a","label","for","which","an","explanation","was","n't","computed",",","will","throw","an","exception",".","Will","be","ignored","for","regression","explanations",".","figsize",":","desired","size","of","pyplot","in","tuple","format",",","defaults","to","(","4,4",")",".","kwargs",":","keyword","arguments",",","passed","to","domain_mapper","Returns",":","pyplot","figure","(","barchart",")","."]
code: def as_pyplot_figure(self, label=1, figsize=(4, 4), **kwargs):
      """Returns the explanation as a pyplot figure.
  
      Will throw an error if you don't have matplotlib installed
      Args:
          label: desired label. If you ask for a label for which an
                 explanation wasn't computed, will throw an exception.
                 Will be ignored for regression explanations.
          figsize: desired size of pyplot in tuple format, defaults to (4,4).
          kwargs: keyword arguments, passed to domain_mapper
  
      Returns:
          pyplot figure (barchart).
      """
      import matplotlib.pyplot as plt
  
      exp = self.as_list(label=label, **kwargs)
      fig = plt.figure(figsize=figsize)
      vals = [x[1] for x in exp]
      names = [x[0] for x in exp]
      vals.reverse()
      names.reverse()
      colors = ["green" if x > 0 else "red" for x in vals]
      pos = np.arange(len(exp)) + 0.5
      plt.barh(pos, vals, align="center", color=colors)
      plt.yticks(pos, names)
      if self.mode == "classification":
          title = (
              "Local explanation for class %s" % self.class_names[label]
          )
      else:
          title = "Local explanation"
      plt.title(title)
      return fig
  
imports: from io import open
  import os
  import os.path
  import json
  import string
  import numpy
  from .exceptions import LimeError
  from sklearn.utils import check_random_state
label_desc: Use image node_id 5 for calling the Explanation obj's underlying member method code with example usage: obj.as_pyplot_figure(label, figsize) and returns: fig