Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. title_temp = "Above and Below Average Temperature for October " + str(user_year)
  2. title_precip = "Above and Below Average Precipitation for October " + str(user_year)
  3. temps_oct = get_column_values(air_temp_data, 11)
  4. precip_oct = get_column_values(precip_data, 11)
  5. mean_temp = statistics.mean(temps_oct)
  6. mean_precip = statistics.mean(precip_oct)
  7. below_mean_temp = get_located_between(air_temp_data, 11, -100, mean_temp)
  8. below_mean_precip = get_located_between(precip_data, 11, 0, mean_precip)
  9. temp_values_below = get_column_values(below_mean_temp, 11)
  10. precip_values_below = get_column_values(below_mean_precip, 11)
  11. percent_below_temp = (len(temp_values_below) / len(temps_oct))*100
  12. percent_above_temp = 100 - percent_below_temp
  13. percent_below_precip = (len(precip_values_below)/len(precip_oct))*100
  14. percent_above_precip = 100 - percent_below_precip
  15. sizes_temp = [percent_below_temp, percent_above_temp]
  16. sizes_precip = [percent_below_precip, percent_above_precip]
  17.  
  18.  
  19. pie_chart_infographic(title_temp, sizes_temp)
  20. pie_chart_infographic(title_precip, sizes_precip)
  21.  
  22. def pie_chart_infographic(title, percent_list):
  23. labels = ['Below the Average', 'Above the Average']
  24. plt.pie(percent_list, labels=labels, autopct='%1.1f%%')
  25. plt.title(title)
  26. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement