Skip to content

Commit

Permalink
Added code to handle matplotlib axisbg vs facecolor
Browse files Browse the repository at this point in the history
  • Loading branch information
devttys0 committed Sep 28, 2017
1 parent aac6ef5 commit 526a979
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/binwalk/modules/entropy.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,15 @@ def plot_entropy(self, fname):
y.append(r.entropy)

fig = plt.figure()
ax = fig.add_subplot(1, 1, 1, autoscale_on=True, axisbg='black')

# axisbg is depreciated, but older versions of matplotlib don't support facecolor.
# This tries facecolor first, thus preventing the annoying depreciation warnings,
# and falls back to axisbg if that fails.
try:
ax = fig.add_subplot(1, 1, 1, autoscale_on=True, facecolor='black')
except AttributeError:
ax = fig.add_subplot(1, 1, 1, autoscale_on=True, axisbg='black')

ax.set_title(fname)
ax.set_xlabel(self.XLABEL)
ax.set_ylabel(self.YLABEL)
Expand Down

0 comments on commit 526a979

Please sign in to comment.