Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lime/explanation.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def as_map(self):
"""
return self.local_exp

def as_pyplot_figure(self, label=1, figsize=(4,4), **kwargs):
def as_pyplot_figure(self, label=1, figsize=(4,4), dpi=100, **kwargs):
"""Returns the explanation as a pyplot figure.

Will throw an error if you don't have matplotlib installed
Expand All @@ -160,13 +160,13 @@ def as_pyplot_figure(self, label=1, figsize=(4,4), **kwargs):
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

dpi: desired DPI(Dots per Inch) of pyplot in integer, default to 100.
Returns:
pyplot figure (barchart).
"""
import matplotlib.pyplot as plt
exp = self.as_list(label=label, **kwargs)
fig = plt.figure(figsize=figsize)
fig = plt.figure(figsize=figsize, dpi=dpi)
vals = [x[1] for x in exp]
names = [x[0] for x in exp]
vals.reverse()
Expand Down