9951 explained code solutions for 126 technologies


python-matplotlibHow to change histogram color


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,color='green')
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

color

sets histogram color

.show()

render chart in a separate window