Commit c03f6c96 authored by Manas Gabani's avatar Manas Gabani

title added in plots

parent 6f640d7b
...@@ -7,8 +7,8 @@ matplotlib.use('Agg') ...@@ -7,8 +7,8 @@ matplotlib.use('Agg')
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
dict_summary={"top3":[],"bottom3":[]} dict_summary={"top3":[],"bottom3":[]}
fig_size_w, fig_size_h = 8, 6 fig_size_ds_w, fig_size_ds_h = 8, 6
fig_size_tr_w, fig_size_tr_h = 8,6 fig_size_tr_w, fig_size_tr_h = 8, 6
def read_all_csv(path='./rawdata_csv/', extension='csv'): def read_all_csv(path='./rawdata_csv/', extension='csv'):
result = glob.glob(path+'SRC_R*.{}'.format(extension)) result = glob.glob(path+'SRC_R*.{}'.format(extension))
...@@ -38,8 +38,9 @@ def statewise_distribution(output_filename, input_df, year, ylabel, main_dimensi ...@@ -38,8 +38,9 @@ def statewise_distribution(output_filename, input_df, year, ylabel, main_dimensi
df_filtered = df_filtered[['Year','State_Name','total','total_by_population']] df_filtered = df_filtered[['Year','State_Name','total','total_by_population']]
df_sum = df_filtered.groupby(['State_Name','Year'],as_index = False).sum().sort_values("total_by_population",ascending=False) df_sum = df_filtered.groupby(['State_Name','Year'],as_index = False).sum().sort_values("total_by_population",ascending=False)
fig = plt.figure(figsize=(fig_size_w,fig_size_h)) fig = plt.figure(figsize=(fig_size_ds_w,fig_size_ds_h))
plt.xticks(rotation=90, ha="right") plt.title(label='KPI: '+ylabel, loc="right", fontsize=15, fontstyle='italic')
plt.xticks(rotation=90, ha="right", fontsize=8)
plt.bar(df_sum['State_Name'],df_sum['total_by_population'], align='center') plt.bar(df_sum['State_Name'],df_sum['total_by_population'], align='center')
# plt.ylabel('Enrollements/Population') # plt.ylabel('Enrollements/Population')
plt.ylabel(ylabel) plt.ylabel(ylabel)
...@@ -68,6 +69,7 @@ def total_enrolment_by_category(output_filename, input_df, main_dimension, state ...@@ -68,6 +69,7 @@ def total_enrolment_by_category(output_filename, input_df, main_dimension, state
plt.plot(df_madr['Year'],df_madr['total'],color='b', label='Madrasas') plt.plot(df_madr['Year'],df_madr['total'],color='b', label='Madrasas')
plt.legend() plt.legend()
plt.title(label='KPI: '+ylabel, loc="right", fontsize=15, fontstyle='italic')
plt.xticks(np.arange(min_year, max_year+1, 1.0)) plt.xticks(np.arange(min_year, max_year+1, 1.0))
plt.ylabel(ylabel) plt.ylabel(ylabel)
plt.xlabel('Year') plt.xlabel('Year')
...@@ -106,6 +108,7 @@ def total_teachers_by_main_dimension(output_filename, input_df, main_dimension, ...@@ -106,6 +108,7 @@ def total_teachers_by_main_dimension(output_filename, input_df, main_dimension,
plt.plot(df_phd['Year'],df_phd['total'],color='m', label='M.Phil / Ph.D') plt.plot(df_phd['Year'],df_phd['total'],color='m', label='M.Phil / Ph.D')
plt.legend() plt.legend()
plt.title(label='KPI: '+"Number of Teachers", loc="right", fontsize=15, fontstyle='italic')
plt.xticks(np.arange(min_year, max_year+1, 1.0)) plt.xticks(np.arange(min_year, max_year+1, 1.0))
plt.ylabel('Number of Teachers') plt.ylabel('Number of Teachers')
plt.xlabel('Year') plt.xlabel('Year')
...@@ -129,6 +132,7 @@ def total_classrooms_by_trend(output_filename, input_df, state_code): ...@@ -129,6 +132,7 @@ def total_classrooms_by_trend(output_filename, input_df, state_code):
plt.plot(df_major_repair['Year'],df_major_repair['total'],color='b', label='Need Major Repair') plt.plot(df_major_repair['Year'],df_major_repair['total'],color='b', label='Need Major Repair')
plt.legend() plt.legend()
plt.title(label='KPI: '+"Number of Classrooms", loc="right", fontsize=15, fontstyle='italic')
plt.xticks(np.arange(min_year, max_year+1, 1.0)) plt.xticks(np.arange(min_year, max_year+1, 1.0))
plt.ylabel('Number of Classrooms') plt.ylabel('Number of Classrooms')
plt.xlabel('Year') plt.xlabel('Year')
...@@ -158,6 +162,7 @@ def total_schools_for_facilities(output_filename, input_df, state_code): ...@@ -158,6 +162,7 @@ def total_schools_for_facilities(output_filename, input_df, state_code):
plt.plot(df_single_teacher['Year'], df_single_teacher['total'], color='m', label='Single Teacher Schools') plt.plot(df_single_teacher['Year'], df_single_teacher['total'], color='m', label='Single Teacher Schools')
plt.legend() plt.legend()
plt.title(label='KPI: '+"Number of Schools", loc="right", fontsize=15, fontstyle='italic')
plt.xticks(np.arange(min_year, max_year+1, 1.0)) plt.xticks(np.arange(min_year, max_year+1, 1.0))
plt.ylabel('Number of Schools') plt.ylabel('Number of Schools')
plt.xlabel('Year') plt.xlabel('Year')
...@@ -187,6 +192,7 @@ def main_dimension_overall(output_filename, input_df, main_dimension, ylabel): ...@@ -187,6 +192,7 @@ def main_dimension_overall(output_filename, input_df, main_dimension, ylabel):
plt.plot(df_major_repair['Year'],df_major_repair['total'],color='b', label='Need Major Repair') plt.plot(df_major_repair['Year'],df_major_repair['total'],color='b', label='Need Major Repair')
plt.legend() plt.legend()
plt.title(label='KPI: '+ylabel, loc="right", fontsize=15, fontstyle='italic')
plt.xticks(np.arange(min_year, max_year+1, 1.0)) plt.xticks(np.arange(min_year, max_year+1, 1.0))
plt.ylabel(ylabel) plt.ylabel(ylabel)
plt.xlabel('Year') plt.xlabel('Year')
...@@ -215,6 +221,7 @@ def total_schools_for_facilities_overall(output_filename, input_df): ...@@ -215,6 +221,7 @@ def total_schools_for_facilities_overall(output_filename, input_df):
plt.plot(df_single_teacher['Year'], df_single_teacher['total'], color='m', label='Single Teacher Schools') plt.plot(df_single_teacher['Year'], df_single_teacher['total'], color='m', label='Single Teacher Schools')
plt.legend() plt.legend()
plt.title(label='KPI: '+"Number of Schools", loc="right", fontsize=15, fontstyle='italic')
plt.xticks(np.arange(min_year, max_year+1, 1.0)) plt.xticks(np.arange(min_year, max_year+1, 1.0))
plt.ylabel('Number of Schools') plt.ylabel('Number of Schools')
plt.xlabel('Year') plt.xlabel('Year')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment