Skip to content

Instantly share code, notes, and snippets.

@language-engineering
Last active October 11, 2015 23:48
Show Gist options
  • Select an option

  • Save language-engineering/3938671 to your computer and use it in GitHub Desktop.

Select an option

Save language-engineering/3938671 to your computer and use it in GitHub Desktop.
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