#5 - WAP in Python to create a bar chart by using multiple x
values on the same chart for men and women.
men: (22,30,35,35,26)
women: (25,32,30,35,29)
import matplotlib.pyplot as
plt
import numpy as np
men= (22,30,35,35,26)
women= (25,32,30,35,29)
x1=np.arange(2,21,4)
plt.bar(x1,men,color='r',label='Men')
plt.bar(x1+2,women,color='b',label='Women')
plt.legend()
plt.xlabel("X
Axis")
plt.ylabel("Y
Axis")
plt.title("Bar
Chart")
plt.show()
No comments:
Post a Comment