Commit e4340300 authored by Manas Gabani's avatar Manas Gabani

text values added in plotss

parent dddb6000
...@@ -45,10 +45,8 @@ def statewise_distribution(output_filename, input_df, year, ylabel, main_dimensi ...@@ -45,10 +45,8 @@ def statewise_distribution(output_filename, input_df, year, ylabel, main_dimensi
plt.yticks(fontsize=7) plt.yticks(fontsize=7)
# 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.barh(df_sum['State_Name'], df_sum['total_by_population'],align='center') plt.barh(df_sum['State_Name'], df_sum['total_by_population'],align='center')
# plt.bar(df_sum['total_by_population'], label=df_sum['State_Name'], align='center')
# plt.ylabel('Enrollements/Population')
plt.xlabel(ylabel)
# plt.ylabel(ylabel) # plt.ylabel(ylabel)
plt.xlabel(ylabel)
list_states=list(df_sum['State_Name']) list_states=list(df_sum['State_Name'])
dict_summary['top3']=[list_states[0],list_states[1],list_states[2]] dict_summary['top3']=[list_states[0],list_states[1],list_states[2]]
dict_summary['bottom3']=[list_states[-1],list_states[-2],list_states[-3]] dict_summary['bottom3']=[list_states[-1],list_states[-2],list_states[-3]]
...@@ -67,11 +65,18 @@ def total_enrolment_by_category(output_filename, input_df, main_dimension, state ...@@ -67,11 +65,18 @@ def total_enrolment_by_category(output_filename, input_df, main_dimension, state
df_govt=df_sum.loc[(df_sum['Sub_Dimension'] == "Government")] df_govt=df_sum.loc[(df_sum['Sub_Dimension'] == "Government")]
df_pvt=df_sum.loc[(df_sum['Sub_Dimension'] == "Private")] df_pvt=df_sum.loc[(df_sum['Sub_Dimension'] == "Private")]
plt.plot(df_govt['Year'],df_govt['total'],color='r', label='Goverment') plt.plot(df_govt['Year'],df_govt['total'],marker='o',color='r', label='Goverment')
plt.plot(df_pvt['Year'],df_pvt['total'],color='g', label='Private') for x, y in zip(df_govt['Year'],df_govt['total']):
plt.text(x = x, y = y, s = '{:.0f}'.format(y), color='r', rotation=15, fontsize=7, weight='bold')
plt.plot(df_pvt['Year'],df_pvt['total'],marker='+',color='g', label='Private')
for x, y in zip(df_pvt['Year'],df_pvt['total']):
plt.text(x = x, y = y, s = '{:.0f}'.format(y), color='g', rotation=15, fontsize=7, weight='bold')
if not 'Rural' in main_dimension: if not 'Rural' in main_dimension:
df_madr=df_sum.loc[(df_sum['Sub_Dimension'] == "Madrasas & Unrecognised")] df_madr=df_sum.loc[(df_sum['Sub_Dimension'] == "Madrasas & Unrecognised")]
plt.plot(df_madr['Year'],df_madr['total'],color='b', label='Madrasas') plt.plot(df_madr['Year'],df_madr['total'],marker='*',color='b', label='Madrasas')
for x, y in zip(df_madr['Year'],df_madr['total']):
plt.text(x = x, y = y, s = '{:.0f}'.format(y), color='b', rotation=15, fontsize=7, weight='bold')
plt.legend() plt.legend()
plt.title(label='KPI: '+ylabel, loc="right", fontsize=15, fontstyle='italic') plt.title(label='KPI: '+ylabel, loc="right", fontsize=15, fontstyle='italic')
...@@ -94,9 +99,15 @@ def total_teachers_by_main_dimension(output_filename, input_df, main_dimension, ...@@ -94,9 +99,15 @@ def total_teachers_by_main_dimension(output_filename, input_df, main_dimension,
df_pvt = df_sum.loc[(df_sum['Sub_Dimension'] == "Private")] df_pvt = df_sum.loc[(df_sum['Sub_Dimension'] == "Private")]
df_madr = df_sum.loc[(df_sum['Sub_Dimension'] == "Madrasas & Unrecognised")] df_madr = df_sum.loc[(df_sum['Sub_Dimension'] == "Madrasas & Unrecognised")]
plt.plot(df_govt['Year'],df_govt['total'],color='r', label='Goverment') plt.plot(df_govt['Year'],df_govt['total'],marker='o',color='r', label='Goverment')
plt.plot(df_pvt['Year'],df_pvt['total'],color='g', label='Private') for x, y in zip(df_govt['Year'],df_govt['total']):
plt.plot(df_madr['Year'],df_madr['total'],color='b', label='Madrasas') plt.text(x = x, y = y, s = '{:.0f}'.format(y), color='r', rotation=15, fontsize=7, weight='bold')
plt.plot(df_pvt['Year'],df_pvt['total'],marker='+',color='g', label='Private')
for x, y in zip(df_pvt['Year'],df_pvt['total']):
plt.text(x = x, y = y, s = '{:.0f}'.format(y), color='g', rotation=15, fontsize=7, weight='bold')
plt.plot(df_madr['Year'],df_madr['total'],marker='*',color='b', label='Madrasas')
for x, y in zip(df_madr['Year'],df_madr['total']):
plt.text(x = x, y = y, s = '{:.0f}'.format(y), color='b', rotation=15, fontsize=7, weight='bold')
else: else:
df_bel_sec = df_sum.loc[(df_sum['Sub_Dimension'] == "Below Secondary")] df_bel_sec = df_sum.loc[(df_sum['Sub_Dimension'] == "Below Secondary")]
df_sec = df_sum.loc[(df_sum['Sub_Dimension'] == "Secondary")] df_sec = df_sum.loc[(df_sum['Sub_Dimension'] == "Secondary")]
...@@ -132,9 +143,15 @@ def total_classrooms_by_trend(output_filename, input_df, state_code): ...@@ -132,9 +143,15 @@ def total_classrooms_by_trend(output_filename, input_df, state_code):
df_minor_repair = df_sum.loc[(df_sum['Sub_Dimension'] == "Need Minor Repair")] df_minor_repair = df_sum.loc[(df_sum['Sub_Dimension'] == "Need Minor Repair")]
df_major_repair = df_sum.loc[(df_sum['Sub_Dimension'] == "Need Major Repair")] df_major_repair = df_sum.loc[(df_sum['Sub_Dimension'] == "Need Major Repair")]
plt.plot(df_good_cond['Year'],df_good_cond['total'],color='r', label='Good Condition') plt.plot(df_good_cond['Year'],df_good_cond['total'],marker='o',color='r', label='Good Condition')
plt.plot(df_minor_repair['Year'],df_minor_repair['total'],color='g', label='Need Minor Repair') for x, y in zip(df_good_cond['Year'],df_good_cond['total']):
plt.plot(df_major_repair['Year'],df_major_repair['total'],color='b', label='Need Major Repair') plt.text(x = x, y = y, s = '{:.0f}'.format(y), color='r', rotation=15, fontsize=7, weight='bold')
plt.plot(df_minor_repair['Year'],df_minor_repair['total'],marker='+',color='g', label='Need Minor Repair')
for x, y in zip(df_minor_repair['Year'],df_minor_repair['total']):
plt.text(x = x, y = y, s = '{:.0f}'.format(y), color='g', rotation=15, fontsize=7, weight='bold')
plt.plot(df_major_repair['Year'],df_major_repair['total'],marker='*',color='b', label='Need Major Repair')
for x, y in zip(df_major_repair['Year'],df_major_repair['total']):
plt.text(x = x, y = y, s = '{:.0f}'.format(y), color='b', rotation=15, fontsize=7, weight='bold')
plt.legend() plt.legend()
plt.title(label='KPI: '+"Number of Classrooms", loc="right", fontsize=15, fontstyle='italic') plt.title(label='KPI: '+"Number of Classrooms", loc="right", fontsize=15, fontstyle='italic')
...@@ -185,16 +202,28 @@ def main_dimension_overall(output_filename, input_df, main_dimension, ylabel): ...@@ -185,16 +202,28 @@ def main_dimension_overall(output_filename, input_df, main_dimension, ylabel):
df_govt=df_sum.loc[(df_sum['Sub_Dimension'] == "Government")] df_govt=df_sum.loc[(df_sum['Sub_Dimension'] == "Government")]
df_pvt=df_sum.loc[(df_sum['Sub_Dimension'] == "Private")] df_pvt=df_sum.loc[(df_sum['Sub_Dimension'] == "Private")]
df_madr=df_sum.loc[(df_sum['Sub_Dimension'] == "Madrasas & Unrecognised")] df_madr=df_sum.loc[(df_sum['Sub_Dimension'] == "Madrasas & Unrecognised")]
plt.plot(df_govt['Year'],df_govt['total'],color='r', label='Goverment') plt.plot(df_govt['Year'],df_govt['total'],marker='o',color='r', label='Goverment')
plt.plot(df_pvt['Year'],df_pvt['total'],color='g', label='Private') for x, y in zip(df_govt['Year'],df_govt['total']):
plt.plot(df_madr['Year'],df_madr['total'],color='b', label='Madrasas') plt.text(x = x, y = y, s = '{:.0f}'.format(y), color='r', rotation=15, fontsize=7, weight='bold')
plt.plot(df_pvt['Year'],df_pvt['total'],marker='+',color='g', label='Private')
for x, y in zip(df_pvt['Year'],df_pvt['total']):
plt.text(x = x, y = y, s = '{:.0f}'.format(y), color='g', rotation=15, fontsize=7, weight='bold')
plt.plot(df_madr['Year'],df_madr['total'],marker='*',color='b', label='Madrasas')
for x, y in zip(df_madr['Year'],df_madr['total']):
plt.text(x = x, y = y, s = '{:.0f}'.format(y), color='b', rotation=15, fontsize=7, weight='bold')
else: else:
df_good_cond = df_sum.loc[(df_sum['Sub_Dimension'] == "Good Condition")] df_good_cond = df_sum.loc[(df_sum['Sub_Dimension'] == "Good Condition")]
df_minor_repair = df_sum.loc[(df_sum['Sub_Dimension'] == "Need Minor Repair")] df_minor_repair = df_sum.loc[(df_sum['Sub_Dimension'] == "Need Minor Repair")]
df_major_repair = df_sum.loc[(df_sum['Sub_Dimension'] == "Need Major Repair")] df_major_repair = df_sum.loc[(df_sum['Sub_Dimension'] == "Need Major Repair")]
plt.plot(df_good_cond['Year'],df_good_cond['total'],color='r', label='Good Condition') plt.plot(df_good_cond['Year'],df_good_cond['total'],marker='o',color='r', label='Good Condition')
plt.plot(df_minor_repair['Year'],df_minor_repair['total'],color='g', label='Need Minor Repair') for x, y in zip(df_good_cond['Year'],df_good_cond['total']):
plt.plot(df_major_repair['Year'],df_major_repair['total'],color='b', label='Need Major Repair') plt.text(x = x, y = y, s = '{:.0f}'.format(y))
plt.plot(df_minor_repair['Year'],df_minor_repair['total'],marker='+',color='g', label='Need Minor Repair')
for x, y in zip(df_minor_repair['Year'],df_minor_repair['total']):
plt.text(x = x, y = y, s = '{:.0f}'.format(y))
plt.plot(df_major_repair['Year'],df_major_repair['total'],marker='*',color='b', label='Need Major Repair')
for x, y in zip(df_major_repair['Year'],df_major_repair['total']):
plt.text(x = x, y = y, s = '{:.0f}'.format(y))
plt.legend() plt.legend()
plt.title(label='KPI: '+ylabel, loc="right", fontsize=15, fontstyle='italic') plt.title(label='KPI: '+ylabel, loc="right", fontsize=15, fontstyle='italic')
......
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