I have this code, using a pandas df:
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import os
path_to = \'Data\\\\2017-04\\\\Mon
A more readable general solution without using the cmap
as you want just 3 colors for specific intervals.
n, bins, patches = plt.hist(df1['Average'], 30)
for c, p in zip(bins, patches):
if c > 0 and c < 4:
plt.setp(p, 'facecolor', 'green')
elif c >= 4 and c < 14 :
plt.setp(p, 'facecolor', 'blue')
else c>=14:
plt.setp(p, 'facecolor', 'yellow')
plt.show()