text_html_output_1.png
import matplotlib.pyplot as plt # for plotting Graphs

import numpy as np # for Linear algebra

import pandas as pd # for data manipulation/CSV I/O

deliveries = pd.read_csv('../input/deliveries.csv')
matches = pd.read_csv('../input/matches.csv')

def autolabel(rects):
    for rect in rects:
        height = rect.get_height()
        ax.text(rect.get_x() + rect.get_width() / 2.0, 1.02 * height, '%d' % int(height), ha='center', va='bottom')

Batsman_score = deliveries.groupby('batsman')['batsman_runs'].agg(sum).reset_index().sort_values(by='batsman_runs', ascending=False).reset_index(drop=True)
Top_batsman_score = Batsman_score.iloc[:15, :]
Top_batsman_score

labels = np.array(Top_batsman_score['batsman'])# x axis label of graph
ind = np.arange(len(labels)) # making them as indexes
width = 0.7 # width of rectangle
fig, ax = plt.subplots() # for figure
rects = ax.bar(ind, np.array(Top_batsman_score['batsman_runs']), width=width, color='blue')# here ind is X
#and np.array(Batsman_Ball_faced_Top['ball']) value is height
ax.set_xticks(ind+((width)/2.))# this is to define the postion in x axis 
ax.set_xticklabels(labels, rotation='vertical') # this is for label x axis
ax.set_ylabel("Count")
ax.set_title("Top Scorer in IPL")
autolabel(rects)

Batsman_Ball_faced = deliveries.groupby(['batsman'])['ball'].count().reset_index().sort_values(by='ball', ascending=False).reset_index(drop=True)
Batsman_Ball_faced_Top = Batsman_Ball_faced.iloc[:15, :]

labels = np.array(Batsman_Ball_faced_Top['batsman'])
ind = np.arange(len(labels))
width = 0.7
fig, ax = plt.subplots()
rects = ax.bar(ind, np.array(Batsman_Ball_faced_Top['ball']), width=width, color='blue')
ax.set_xticks(ind + width / 2.0)
ax.set_xticklabels(labels, rotation='vertical')
ax.set_ylabel('Count')
ax.set_title('Ball faced by Batsman in IPL')
autolabel(rects)