Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
652 B
1
Indexable
Never
import matplotlib.pyplot as plt

# Given data
classes = ['10-14', '15-19', '20-24', '25-29', '30-34', '35-39', '40-44']
frequencies = [7, 9, 5, 4, 5, 3, 2]
class_midpoints = [13, 18, 23, 28, 33, 38, 43]

# Plotting the histogram
plt.figure(figsize=(10, 5))
plt.bar(classes, frequencies, color='skyblue')
plt.xlabel('Class Intervals')
plt.ylabel('Frequency')
plt.title('Histogram of Class Intervals')
plt.show()

# Plotting the frequency polygon
plt.figure(figsize=(10, 5))
plt.plot(class_midpoints, frequencies, marker='o', color='red')
plt.xlabel('Class Midpoints')
plt.ylabel('Frequency')
plt.title('Frequency Polygon of Class Intervals')
plt.show()
Leave a Comment