Bar chart plotting


In [1]:
import matplotlib.pyplot as plt
from collections import Counter


def bar_chart(plt):

    plt.figure(figsize=(20, 10))

    years = [2000, 2002, 2005, 2007, 2010, 2012, 2014, 2015]

    num_websites = [17, 38, 64, 121, 206, 697, 968, 863]

    xs = [i + 0.1 for i, _ in enumerate(years)]

    plt.bar(xs, num_websites, color='green')
    plt.ylabel("# of Websites (millions)")
    plt.title("Total number of websites online")

    plt.xticks([i + 0.5 for i, _ in enumerate(years)],
               years, color='blue')

    plt.show()


if __name__ == "__main__":

    bar_chart(plt)