9951 explained code solutions for 126 technologies


python-matplotlibHow to plot histogram


import matplotlib.pyplot as plt

x = [1,2,5,1,2,3,5,6,7,4,2,2,4,5,6]
plt.hist(x,bins=5)
plt.show()ctrl + c
import matplotlib.pyplot as plt

loads Matplotlib module to use plotting capabilities

.hist(

plots histogram for specified data

bins

number of histogram bins (bars) to group data into

.show()

render chart in a separate window