Sunday, 9 August 2015

Charts in Python [matplotlib]

A picture speaks thousand words. Any data which is expressed in terms of graph, pie chart are so easy to be conceived by the audience.

Objective:

To draw a bar-graph using matplotlib in python.

Procedure:

step 1: import matplotlib package,

                  import matplotlib.pyplot as plt

step 2: draw the bar graph with the values (vote)

                  plt.bar(range(len(counts)), counts.values(), align='center')

step 3: print bar graph

                  plt.show()


Output:



No comments:

Post a Comment