import pandas as pd
import matplotlib.pyplot as plt
plt.rc('figure', figsize=(10, 8))
plt.style.use('seaborn-white')
ages = [18, 18, 21, 25, 26, 30, 32, 38, 45, 55]
bins= [10, 20, 30, 40, 50, 60]
# plt.hist(ages, bins=5, edgecolor='black')
# plt.hist(ages, bins=bins, edgecolor='black')
# excluding data for age 10
plt.hist(ages, bins=bins[1:], edgecolor='black')
plt.title('Age of Respondants')
plt.xlabel('Ages')
plt.ylabel('Total Respondants')
plt.tight_layout()
plt.show()
data = pd.read_csv(r'examples/data_6.csv')
# data.head()
ids = data['Responder_id']
ages = data['Age']
bins = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
median_age = 29
color = '#fc4f30'
# plt.hist(ages, bins=bins, edgecolor='black')
plt.hist(ages, bins=bins, edgecolor='black', log=True)
plt.axvline(median_age, color=color,
linewidth=2, label='Age Median')
plt.grid(True)
plt.legend()
plt.title('Age of Respondants')
plt.xlabel('Ages')
plt.ylabel('Total Respondants')
plt.tight_layout()
plt.show()