Skip to content

Commit

Permalink
Merge pull request udacity#342 from DavidMachineLearning/patch-2
Browse files Browse the repository at this point in the history
Fix on issue udacity#340
  • Loading branch information
fixingitnow committed Oct 8, 2018
2 parents ed7d739 + 117f68c commit e6684c2
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions projects/finding_donors/visuals.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def evaluate(results, accuracy, f1):
"""

# Create figure
fig, ax = pl.subplots(2, 3, figsize = (11,7))
fig, ax = pl.subplots(2, 4, figsize = (11,7))

# Constants
bar_width = 0.3
Expand Down Expand Up @@ -106,12 +106,14 @@ def evaluate(results, accuracy, f1):
ax[1, 1].set_ylim((0, 1))
ax[1, 2].set_ylim((0, 1))

# Create patches for the legend
patches = []
# Set additional plots invisibles
ax[0, 3].set_visible(False)
ax[1, 3].axis('off')

# Create legend
for i, learner in enumerate(results.keys()):
patches.append(mpatches.Patch(color = colors[i], label = learner))
pl.legend(handles = patches, bbox_to_anchor = (-.80, 2.53), \
loc = 'upper center', borderaxespad = 0., ncol = 3, fontsize = 'x-large')
pl.bar(0, 0, color=colors[i], label=learner)
pl.legend()

# Aesthetics
pl.suptitle("Performance Metrics for Three Supervised Learning Models", fontsize = 16, y = 1.10)
Expand Down

0 comments on commit e6684c2

Please sign in to comment.