9951 explained code solutions for 126 technologies


python-matplotlibHow to customize histogram bins


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=[0,5,6,7],edgecolor='white')
plt.show()ctrl + c
import matplotlib.pyplot as plt

loads Matplotlib module to use plotting capabilities

.hist(

plots histogram for specified data

bins

we can specify list of values to build bins based on

edgecolor

sets histogram bar border color

.show()

render chart in a separate window