Informatics Practices
Create/draw frequency polygon from the data used in above questions.
PyPlot
2 Likes
Answer
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
weights = [78, 72, 69, 81, 63, 67, 65, 75, 79, 74, 71, 83, 71, 79, 80, 69]
plt.figure(figsize = (10, 5))
n, edges, p = plt.hist(weights, bins = 40, histtype = 'step')
m = 0.5 * (edges[1:] + edges[:-1])
m = m.tolist()
l = len(m)
m.insert(0, m[0] - 10)
m.append(m[l-1] + 10)
n = n.tolist()
n.insert(0, 0)
n.append(0)
plt.plot(m, n, '-^')
plt.show()
Output

Answered By
1 Like
Related Questions
Create an ndarray containing 16 values and then plot this array along with dataset of previous question in same histogram, horizontal histograms.
Out of above plotted histograms, which ones can be used for creating frequency polygons ? Can you draw frequency polygons from all the above histograms ?
From the following ordered set of data :
63, 65, 67, 69, 69, 71, 71, 72, 74, 75, 78, 79, 79, 80, 81, 83Create a horizontal boxplot.
From the following ordered set of data :
63, 65, 67, 69, 69, 71, 71, 72, 74, 75, 78, 79, 79, 80, 81, 83Create a vertical boxplot.