[Solved] Given below are the sugar levels for men and women in a city. Compare the sugar levels amongst them through a histogram.

   RSS

1
Topic starter

Given below are the sugar levels for men and women in a city. Compare the sugar levels amongst them through a histogram.

 

Men : [113,85,90,150,149,88,93,115,135,80,77,82,129]

Women : [67,98,89,120,133,150,84,69,79,120,112,100]

1 Answer
1
Topic starter
import matplotlib.pylab as plt


sugar_men = [113,85,90,150,149,88,93,115,135,80,77,82]
sugar_women = [67,98,89,120,133,150,84,69,79,120,112,100]


plt.title("Blood Sugar Analysis")
plt.hist([sugar_men,sugar_women],bins=[80,100,120,140,160], color=["red", "blue"], label=["Men", "Women"])
plt.xlabel("Blood Sugar Range")
plt.ylabel("No. of Patients")
plt.legend()
plt.show()