KnowledgeBoat Logo
|

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
Create/draw frequency polygon from the data used in above questions. Plotting with Pyplot, Informatics Practices Computer Science Sumita Arora Solutions CBSE Class 12

Answered By

1 Like


Related Questions