Untitled

 avatar
unknown
plain_text
15 days ago
368 B
1
Indexable
import matplotlib.pyplot as plt
import numpy as np

ages = np.array([57, 45, 35, 30, 31, 28, 32, 44, 35, 31])

# Histogram
plt.hist(ages, bins=5)  # Adjust 'bins' as needed
plt.xlabel("Age")
plt.ylabel("Frequency")
plt.title("Histogram of Respondent Ages")
plt.show()

# Box plot
plt.boxplot(ages)
plt.ylabel("Age")
plt.title("Box Plot of Respondent Ages")
plt.show()
Leave a Comment