Last active
October 11, 2015 23:48
-
-
Save language-engineering/3938671 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import matplotlib | |
| matplotlib.use("Qt4Agg") # on OSX this needs to be matplotlib.use("MacOSX") | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| def plot_results(results, title, xlabels, ylabel="Accuracy"): | |
| '''Plot a bar graph of results''' | |
| ind = np.arange(len(results)) | |
| width = 0.4 | |
| plt.bar(ind, results, width, color="#1AADA4") | |
| plt.ylabel(ylabel) | |
| plt.ylim(ymax=100) | |
| plt.xticks(ind+width/2.0, xlabels) | |
| plt.title(title) | |
| plt.show() | |
| #Example usage | |
| plot_results([67, 54, 44, 33],"DVD classifier",['dvd', 'elec', 'book', 'kitchen']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment