import matplotlib.pyplot as plt; plt.rcdefaults()
import numpy as np
data = []
fh = open("hacker_poll.txt")
for line in fh:
language, votes = line.strip().rsplit(None, 1)
data.append((language, int(votes)))
data.sort(key=lambda x: (x[1], x[0]), reverse = True)
languages, votes = zip(*data[:10])
languages = np.asarray(languages)
votes = np.asarray(votes)
index = np.arange(len(votes))
bar_width = 1.0
plt.bar(index, votes, bar_width, color="blue")
plt.xticks(index +bar_width / 2, languages)
plt.show()
# April 2012, Hacker News 'Survey, reader poll