Data of 500 Cities with population more than 1 Lac by Census 2011

Attributes Info

  • 'name_of_city' : Name of the City
  • 'state_code' : State Code of the City
  • 'state_name' : State Name of the City
  • 'dist_code' : District Code where the city belongs ( 99 means multiple district )
  • 'population_total' : Total Population
  • 'population_male' : Male Population
  • 'population_female' : Female Population
  • '0-6_population_total' : 0-6 Age Total Population
  • '0-6_population_male' : 0-6 Age Male Population
  • '0-6_population_female' : 0-6 Age Female Population
  • 'literates_total' : Total Literates
  • 'literates_male' : Male Literates
  • 'literates_female' : Female Literates
  • 'sex_ratio' : Sex Ratio
  • 'child_sex_ratio' : Sex ratio in 0-6
  • 'effective_literacy_rate_total' : Literacy rate over Age 7
  • 'effective_literacy_rate_male' : Male Literacy rate over Age 7
  • 'effective_literacy_rate_female': Female Literacy rate over Age 7
  • 'location' : Lat,Lng
  • 'total_graduates' : Total Number of Graduates
  • 'male_graduates' : Male Graduates
  • 'female_graduates' : Female Graduates

Import Libraries

In [1]:
import pandas as pd
import numpy as np
from numpy import array
import seaborn as sns
import matplotlib as mpl
from matplotlib import cm
import matplotlib.pyplot as plt
import datetime
%matplotlib inline

Dataset

Get data and take a look

In [2]:
df = pd.read_csv(r"E:\ML - Data\India's 500 Cities Data\cities_r2.csv")
In [3]:
df.head()
Out[3]:
name_of_city state_code state_name dist_code population_total population_male population_female 0-6_population_total 0-6_population_male 0-6_population_female ... literates_female sex_ratio child_sex_ratio effective_literacy_rate_total effective_literacy_rate_male effective_literacy_rate_female location total_graduates male_graduates female_graduates
0 Abohar 3 PUNJAB 9 145238 76840 68398 15870 8587 7283 ... 44972 890 848 79.86 85.49 73.59 30.1452928,74.1993043 16287 8612 7675
1 Achalpur 27 MAHARASHTRA 7 112293 58256 54037 11810 6186 5624 ... 43086 928 909 91.99 94.77 89.00 21.257584,77.5086754 8863 5269 3594
2 Adilabad 28 ANDHRA PRADESH 1 117388 59232 58156 13103 6731 6372 ... 37660 982 947 80.51 88.18 72.73 19.0809075,79.560344 10565 6797 3768
3 Adityapur 20 JHARKHAND 24 173988 91495 82493 23042 12063 10979 ... 54515 902 910 83.46 89.98 76.23 22.7834741,86.1576889 19225 12189 7036
4 Adoni 28 ANDHRA PRADESH 21 166537 82743 83794 18406 9355 9051 ... 45089 1013 968 68.38 76.58 60.33 15.6322227,77.2728368 11902 7871 4031

5 rows × 22 columns

In [4]:
df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 493 entries, 0 to 492
Data columns (total 22 columns):
name_of_city                      493 non-null object
state_code                        493 non-null int64
state_name                        493 non-null object
dist_code                         493 non-null int64
population_total                  493 non-null int64
population_male                   493 non-null int64
population_female                 493 non-null int64
0-6_population_total              493 non-null int64
0-6_population_male               493 non-null int64
0-6_population_female             493 non-null int64
literates_total                   493 non-null int64
literates_male                    493 non-null int64
literates_female                  493 non-null int64
sex_ratio                         493 non-null int64
child_sex_ratio                   493 non-null int64
effective_literacy_rate_total     493 non-null float64
effective_literacy_rate_male      493 non-null float64
effective_literacy_rate_female    493 non-null float64
location                          493 non-null object
total_graduates                   493 non-null int64
male_graduates                    493 non-null int64
female_graduates                  493 non-null int64
dtypes: float64(3), int64(16), object(3)
memory usage: 84.8+ KB
In [5]:
df.describe()
Out[5]:
state_code dist_code population_total population_male population_female 0-6_population_total 0-6_population_male 0-6_population_female literates_total literates_male literates_female sex_ratio child_sex_ratio effective_literacy_rate_total effective_literacy_rate_male effective_literacy_rate_female total_graduates male_graduates female_graduates
count 493.000000 493.000000 4.930000e+02 4.930000e+02 4.930000e+02 4.930000e+02 493.000000 493.000000 4.930000e+02 4.930000e+02 4.930000e+02 493.000000 493.000000 493.000000 493.000000 493.000000 4.930000e+02 4.930000e+02 4.930000e+02
mean 18.643002 16.782961 4.481124e+05 2.343468e+05 2.137656e+05 4.709285e+04 24849.527383 22243.320487 3.461527e+05 1.894384e+05 1.567143e+05 930.294118 902.332657 85.131460 89.920162 79.967181 6.620236e+04 3.771556e+04 2.848680e+04
std 9.297168 15.566131 1.033228e+06 5.487786e+05 4.848622e+05 1.050279e+05 55535.310272 49523.241379 8.220952e+05 4.534753e+05 3.690677e+05 55.849106 49.794689 6.186345 5.377492 7.577825 1.778187e+05 9.849574e+04 7.951556e+04
min 1.000000 1.000000 1.000360e+05 5.020100e+04 4.512600e+04 6.547000e+03 3406.000000 3107.000000 5.699800e+04 3.475100e+04 2.224700e+04 700.000000 762.000000 49.510000 52.270000 46.450000 2.532000e+03 1.703000e+03 8.290000e+02
25% 9.000000 7.000000 1.261420e+05 6.638400e+04 6.041100e+04 1.363900e+04 7221.000000 6457.000000 9.768700e+04 5.357800e+04 4.391400e+04 890.000000 868.000000 81.750000 87.280000 75.800000 1.527700e+04 9.289000e+03 6.114000e+03
50% 19.000000 13.000000 1.841330e+05 9.665500e+04 8.776800e+04 1.944000e+04 10342.000000 9172.000000 1.413290e+05 7.590600e+04 6.383600e+04 922.000000 903.000000 85.970000 91.180000 80.920000 2.395900e+04 1.404900e+04 9.558000e+03
75% 27.000000 21.000000 3.490330e+05 1.750550e+05 1.700260e+05 3.794500e+04 19982.000000 17954.000000 2.679000e+05 1.455480e+05 1.235030e+05 971.000000 942.000000 89.330000 93.400000 85.400000 5.036700e+04 2.787200e+04 2.086600e+04
max 35.000000 99.000000 1.247845e+07 6.736815e+06 5.741632e+06 1.209275e+06 647938.000000 561337.000000 1.023759e+07 5.727774e+06 4.509812e+06 1093.000000 1185.000000 98.800000 99.300000 98.310000 2.221137e+06 1.210040e+06 1.011097e+06
In [6]:
df.shape
Out[6]:
(493, 22)

preparing co-ordinate details for further work on dataset

In [7]:
# Extracting Co-ordinates details from the provided data
df['latitude'] = df['location'].apply(lambda x: x.split(',')[0])
df['longitude'] = df['location'].apply(lambda x: x.split(',')[1])
df.head()
Out[7]:
name_of_city state_code state_name dist_code population_total population_male population_female 0-6_population_total 0-6_population_male 0-6_population_female ... child_sex_ratio effective_literacy_rate_total effective_literacy_rate_male effective_literacy_rate_female location total_graduates male_graduates female_graduates latitude longitude
0 Abohar 3 PUNJAB 9 145238 76840 68398 15870 8587 7283 ... 848 79.86 85.49 73.59 30.1452928,74.1993043 16287 8612 7675 30.1452928 74.1993043
1 Achalpur 27 MAHARASHTRA 7 112293 58256 54037 11810 6186 5624 ... 909 91.99 94.77 89.00 21.257584,77.5086754 8863 5269 3594 21.257584 77.5086754
2 Adilabad 28 ANDHRA PRADESH 1 117388 59232 58156 13103 6731 6372 ... 947 80.51 88.18 72.73 19.0809075,79.560344 10565 6797 3768 19.0809075 79.560344
3 Adityapur 20 JHARKHAND 24 173988 91495 82493 23042 12063 10979 ... 910 83.46 89.98 76.23 22.7834741,86.1576889 19225 12189 7036 22.7834741 86.1576889
4 Adoni 28 ANDHRA PRADESH 21 166537 82743 83794 18406 9355 9051 ... 968 68.38 76.58 60.33 15.6322227,77.2728368 11902 7871 4031 15.6322227 77.2728368

5 rows × 24 columns

Visualization on top 500 Indian cities

List of top 10 highly populated cities of India

Greater Mumbai is the most populated city of India. Delhi, Bengalurur and Greater hyderabad are top cities listed by total population.
In [8]:
pop_cities = df.sort_values(by = 'population_total', ascending = False)
ten_pop_cities = pop_cities.head(10)
ten_pop_cities
Out[8]:
name_of_city state_code state_name dist_code population_total population_male population_female 0-6_population_total 0-6_population_male 0-6_population_female ... child_sex_ratio effective_literacy_rate_total effective_literacy_rate_male effective_literacy_rate_female location total_graduates male_graduates female_graduates latitude longitude
185 Greater Mumbai 27 MAHARASHTRA 99 12478447 6736815 5741632 1139146 599007 540139 ... 902 90.28 93.32 86.70 19.0760,72.8777 1802371 964964 837407 19.0760 72.8777
141 Delhi 7 NCT OF DELHI 99 11007835 5871362 5136473 1209275 647938 561337 ... 866 87.60 91.44 83.20 28.7041,77.1025 2221137 1210040 1011097 28.7041 77.1025
72 Bengaluru 29 KARNATAKA 18 8425970 4401299 4024671 862493 444639 417854 ... 940 89.59 92.63 86.25 12.9716,77.5946 1591163 908363 682800 12.9716 77.5946
184 Greater Hyderabad 28 ANDHRA PRADESH 99 6809970 3500802 3309168 725816 373794 352022 ... 942 82.96 85.96 79.79 17.3850,78.4867 1164149 685402 478747 17.3850 78.4867
7 Ahmadabad 24 GUJARAT 7 5570585 2935869 2634716 589076 317917 271159 ... 853 89.62 93.96 84.81 23.022505,72.5713621 769858 435267 334591 23.022505 72.5713621
119 Chennai 33 TAMIL NADU 2 4681087 2357633 2323454 418541 213084 205457 ... 964 90.33 93.47 87.16 13.0826802,80.2707184 879695 487428 392267 13.0826802 80.2707184
274 Kolkata 19 WEST BENGAL 16 4486679 2362662 2124017 300052 155475 144577 ... 930 87.14 89.08 84.98 22.572646,88.363895 818476 461615 356861 22.572646 88.363895
449 Surat 24 GUJARAT 25 4462002 2538243 1923759 531522 293208 238314 ... 813 89.03 92.76 84.05 21.1702401,72.8310607 278795 160566 118229 21.1702401 72.8310607
380 Pune 27 MAHARASHTRA 25 3115431 1602137 1513294 324572 171152 153420 ... 896 91.61 95.13 87.91 18.5204303,73.8567437 656508 349022 307486 18.5204303 73.8567437
225 Jaipur 8 RAJASTHAN 12 3073350 1619280 1454070 378788 204320 174468 ... 854 84.34 90.61 77.41 26.9124336,75.7872709 533148 319107 214041 26.9124336 75.7872709

10 rows × 24 columns

Which are the top 10 highly populated cities of the country in map

In [9]:
from mpl_toolkits.basemap import Basemap

plt.subplots(figsize=(20, 15))

map = Basemap(width=1200000,height=900000,projection='lcc',resolution='l',
                    llcrnrlon=67,llcrnrlat=5,urcrnrlon=99,urcrnrlat=37,lat_0=28,lon_0=77)
#set a background colour
map.drawmapboundary(fill_color='#85A6D9')

# draw coastlines, country boundaries, fill continents.
map.fillcontinents(color='white',lake_color='#85A6D9')
map.drawcoastlines(color='#6D5F47', linewidth=.4)
map.drawcountries(color='#6D5F47', linewidth=.4)

# lat/lon coordinates of top ten indian cities
lngs=array(ten_pop_cities['longitude'])
lats=array(ten_pop_cities['latitude'])
populations = array(ten_pop_cities['population_total'])
nc=array(ten_pop_cities['name_of_city'])

#scale populations to emphasise different relative pop sizes
s_populations = [p/5000 for p in populations]

# compute the native map projection coordinates for cities
x,y = map(lngs,lats)

#scatter scaled circles at the city locations
map.scatter(
    x,
    y,
    s=s_populations, #size
    c=s_populations, #color
    marker='o', #symbol
    alpha=0.75, #transparency
    zorder = 2, #plotting order
    cmap = cm.Dark2
    )

# plot population labels of the ten cities.
for name, xpt, ypt in zip(nc, x, y):
    plt.text(
        xpt+60000,
        ypt+30000,
        name,
        fontsize= 15,
        fontweight='bold',
        horizontalalignment='center',
        verticalalignment='center',
        zorder = 3,
        )
    
#add a title and display the map on screen
plt.title('Top Ten Cities of India By Population', fontsize=20)
plt.show()
C:\Users\rabiulawal\Anaconda3\lib\site-packages\mpl_toolkits\basemap\__init__.py:3236: MatplotlibDeprecationWarning: The ishold function was deprecated in version 2.0.
  b = ax.ishold()
C:\Users\rabiulawal\Anaconda3\lib\site-packages\mpl_toolkits\basemap\__init__.py:3245: MatplotlibDeprecationWarning: axes.hold is deprecated.
    See the API Changes document (http://matplotlib.org/api/api_changes.html)
    for more details.
  ax.hold(b)

custom function for map ploting

In [10]:
def plot_map(sz, colorbarVal, title):
    plt.subplots(figsize=(20, 15))

    map = Basemap(width=1200000,height=900000,projection='lcc',resolution='l',
                    llcrnrlon=67,llcrnrlat=5,urcrnrlon=99,urcrnrlat=37,lat_0=28,lon_0=77)
    #set a background colour
    map.drawmapboundary(fill_color='#85A6D9')

    # draw coastlines, country boundaries, fill continents.
    map.fillcontinents(color='white',lake_color='#85A6D9')
    map.drawcoastlines(color='#6D5F47', linewidth=.4)
    map.drawcountries(color='#6D5F47', linewidth=.4)

    # lat/lon coordinates of top ten indian cities
    lngs=array(df['longitude'])
    lats=array(df['latitude'])

    # compute the native map projection coordinates for cities
    x,y = map(lngs,lats)

    #scatter scaled circles at the city locations
    cs = map.scatter(
        x,
        y,
        s=sz, #size
        c=sz, #color
        marker='o', #symbol
        alpha=0.5, #transparency
        zorder = 2, #plotting order
        cmap = cm.Dark2
        )
    
    # adding colorbar
    cbar = map.colorbar(cs, location='right',pad="5%")
    cbar.ax.set_yticklabels(colorbarVal)
    
    #add a title and display the map on screen
    plt.title(title, fontsize=20)
    plt.show()

States by number of cities in 500

In [11]:
plt.figure(figsize=(15, 5))
city_states = df.groupby(['state_name'])['name_of_city'].count().sort_values(ascending = False)
city_states.plot(kind = 'bar', fontsize = 12, )
plt.grid(b=True, which='both', color='Black',linestyle='-')
plt.xlabel('States', fontsize=15)
plt.ylabel('Population', fontsize=15)
plt.title('States by number of cities in top 500', fontsize = 20)
plt.show ()

Uttara Pradesh and West Bengal has most cities of India, more than 60 cities in each. Meghalaya, Mizoram, Nagaland and Anadaman & Nicobar Islands are the least counted states (less than 5 cities).

Most populated states of India

In [12]:
plt.figure(figsize=(15, 5))
pop_states = df[['population_total','state_name']].groupby(['state_name'])['population_total'].sum().sort_values(ascending = False)
pop_states.plot(kind = 'bar', fontsize = 12, alpha = 1)
plt.grid(b=True, which='both', color='Black',linestyle='-')
plt.xlabel('States', fontsize=15)
plt.ylabel('Population', fontsize=15)
plt.title('States by Total population in top 500', fontsize = 20)
plt.show ()

Total population of the country in cities map

India is one of the over populated country in the world. In this dataset we can see 220919400 population in total lives in 500 cities of India.

In [13]:
# Plotting the same on the map
population_sizes = df["population_total"].apply(lambda x: int(x / 5000))
colorbarValue = np.linspace(df["population_total"].min(), df["population_total"].max(), 
                            num=10)
colorbarValue = colorbarValue.astype(int)
title = 'Population of Cities in Indian Map'
plot_map(population_sizes, colorbarValue, title)
C:\Users\rabiulawal\Anaconda3\lib\site-packages\mpl_toolkits\basemap\__init__.py:3236: MatplotlibDeprecationWarning: The ishold function was deprecated in version 2.0.
  b = ax.ishold()
C:\Users\rabiulawal\Anaconda3\lib\site-packages\mpl_toolkits\basemap\__init__.py:3245: MatplotlibDeprecationWarning: axes.hold is deprecated.
    See the API Changes document (http://matplotlib.org/api/api_changes.html)
    for more details.
  ax.hold(b)

most male populated states

In [14]:
plt.figure(figsize=(15, 5))
pop_male_states = df.groupby(['state_name'])['population_male'].sum().sort_values(ascending = False)
pop_male_states.plot(kind = 'bar', fontsize = 12)
plt.grid(b=True, which='both', color='Black',linestyle='-')
plt.xlabel('States', fontsize=15)
plt.ylabel('Population Male', fontsize=15)
plt.title('States by Total Male Population in Top 500 cities', fontsize = 20)
plt.show ()

male population of cities in the country map

In [15]:
# Plotting the same on the map
population_sizes = df["population_male"].apply(lambda x: int(x / 5000))
colorbarValue = np.linspace(df["population_male"].min(), df["population_male"].max(), 
                            num=10)
colorbarValue = colorbarValue.astype(int)
title = "Male Population of Cities in India's Map"
plot_map(population_sizes, colorbarValue, title)
C:\Users\rabiulawal\Anaconda3\lib\site-packages\mpl_toolkits\basemap\__init__.py:3236: MatplotlibDeprecationWarning: The ishold function was deprecated in version 2.0.
  b = ax.ishold()
C:\Users\rabiulawal\Anaconda3\lib\site-packages\mpl_toolkits\basemap\__init__.py:3245: MatplotlibDeprecationWarning: axes.hold is deprecated.
    See the API Changes document (http://matplotlib.org/api/api_changes.html)
    for more details.
  ax.hold(b)

most female populated states

In [16]:
plt.figure(figsize=(15, 5))
pop_female_states = df.groupby(['state_name'])['population_female'].sum().sort_values(ascending = False)
pop_female_states.plot(kind = 'bar', fontsize = 12)
plt.grid(b=True, which='both', color='Black',linestyle='-')
plt.xlabel('Population Male', fontsize=15)
plt.ylabel('States', fontsize=15)
plt.title('States by most female populion in top 500 cities', fontsize = 20)
plt.show ()

Female populated cities

In [17]:
# Plotting the same on the map
population_sizes = df["population_female"].apply(lambda x: int(x / 5000))
colorbarValue = np.linspace(df["population_female"].min(), df["population_female"].max(), 
                            num=10)
colorbarValue = colorbarValue.astype(int)
title = "Female Population of Cities in India's Map"
plot_map(population_sizes, colorbarValue, title)
C:\Users\rabiulawal\Anaconda3\lib\site-packages\mpl_toolkits\basemap\__init__.py:3236: MatplotlibDeprecationWarning: The ishold function was deprecated in version 2.0.
  b = ax.ishold()
C:\Users\rabiulawal\Anaconda3\lib\site-packages\mpl_toolkits\basemap\__init__.py:3245: MatplotlibDeprecationWarning: axes.hold is deprecated.
    See the API Changes document (http://matplotlib.org/api/api_changes.html)
    for more details.
  ax.hold(b)

top ten male populated cities in map

In [18]:
male_pop_cities = df.sort_values(by = 'population_total', ascending = False)
ten_male_pop_cities = pop_cities.head(10)
ten_male_pop_cities
Out[18]:
name_of_city state_code state_name dist_code population_total population_male population_female 0-6_population_total 0-6_population_male 0-6_population_female ... child_sex_ratio effective_literacy_rate_total effective_literacy_rate_male effective_literacy_rate_female location total_graduates male_graduates female_graduates latitude longitude
185 Greater Mumbai 27 MAHARASHTRA 99 12478447 6736815 5741632 1139146 599007 540139 ... 902 90.28 93.32 86.70 19.0760,72.8777 1802371 964964 837407 19.0760 72.8777
141 Delhi 7 NCT OF DELHI 99 11007835 5871362 5136473 1209275 647938 561337 ... 866 87.60 91.44 83.20 28.7041,77.1025 2221137 1210040 1011097 28.7041 77.1025
72 Bengaluru 29 KARNATAKA 18 8425970 4401299 4024671 862493 444639 417854 ... 940 89.59 92.63 86.25 12.9716,77.5946 1591163 908363 682800 12.9716 77.5946
184 Greater Hyderabad 28 ANDHRA PRADESH 99 6809970 3500802 3309168 725816 373794 352022 ... 942 82.96 85.96 79.79 17.3850,78.4867 1164149 685402 478747 17.3850 78.4867
7 Ahmadabad 24 GUJARAT 7 5570585 2935869 2634716 589076 317917 271159 ... 853 89.62 93.96 84.81 23.022505,72.5713621 769858 435267 334591 23.022505 72.5713621
119 Chennai 33 TAMIL NADU 2 4681087 2357633 2323454 418541 213084 205457 ... 964 90.33 93.47 87.16 13.0826802,80.2707184 879695 487428 392267 13.0826802 80.2707184
274 Kolkata 19 WEST BENGAL 16 4486679 2362662 2124017 300052 155475 144577 ... 930 87.14 89.08 84.98 22.572646,88.363895 818476 461615 356861 22.572646 88.363895
449 Surat 24 GUJARAT 25 4462002 2538243 1923759 531522 293208 238314 ... 813 89.03 92.76 84.05 21.1702401,72.8310607 278795 160566 118229 21.1702401 72.8310607
380 Pune 27 MAHARASHTRA 25 3115431 1602137 1513294 324572 171152 153420 ... 896 91.61 95.13 87.91 18.5204303,73.8567437 656508 349022 307486 18.5204303 73.8567437
225 Jaipur 8 RAJASTHAN 12 3073350 1619280 1454070 378788 204320 174468 ... 854 84.34 90.61 77.41 26.9124336,75.7872709 533148 319107 214041 26.9124336 75.7872709

10 rows × 24 columns

In [19]:
from mpl_toolkits.basemap import Basemap

plt.subplots(figsize=(20, 15))

map = Basemap(width=1200000,height=900000,projection='lcc',resolution='l',
                    llcrnrlon=67,llcrnrlat=5,urcrnrlon=99,urcrnrlat=37,lat_0=28,lon_0=77)
#set a background colour
map.drawmapboundary(fill_color='#85A6D9')

# draw coastlines, country boundaries, fill continents.
map.fillcontinents(color='white',lake_color='#85A6D9')
map.drawcoastlines(color='#6D5F47', linewidth=.4)
map.drawcountries(color='#6D5F47', linewidth=.4)

# lat/lon coordinates of top ten indian cities
lngs=array(ten_pop_cities['longitude'])
lats=array(ten_pop_cities['latitude'])
populations = array(ten_pop_cities['population_male'])
nc=array(ten_pop_cities['name_of_city'])

#scale populations to emphasise different relative pop sizes
s_populations = [p/5000 for p in populations]

# compute the native map projection coordinates for cities
x,y = map(lngs,lats)

#scatter scaled circles at the city locations
map.scatter(
    x,
    y,
    s=s_populations, #size
    c=s_populations, #color
    marker='o', #symbol
    alpha=0.75, #transparency
    zorder = 2, #plotting order
    cmap = cm.Dark2
    )

# plot population labels of the ten cities.
for name, xpt, ypt in zip(nc, x, y):
    plt.text(
        xpt+60000,
        ypt+30000,
        name,
        fontsize= 15,
        fontweight='bold',
        horizontalalignment='center',
        verticalalignment='center',
        zorder = 3,
        )
    
#add a title and display the map on screen
plt.title('Top Ten Cities of India By male population', fontsize=20)
plt.show()
C:\Users\rabiulawal\Anaconda3\lib\site-packages\mpl_toolkits\basemap\__init__.py:3236: MatplotlibDeprecationWarning: The ishold function was deprecated in version 2.0.
  b = ax.ishold()
C:\Users\rabiulawal\Anaconda3\lib\site-packages\mpl_toolkits\basemap\__init__.py:3245: MatplotlibDeprecationWarning: axes.hold is deprecated.
    See the API Changes document (http://matplotlib.org/api/api_changes.html)
    for more details.
  ax.hold(b)