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\MonthlyDataq1analysisEnergy Usage' # where to save
df = pd.read_csv('April2017NEW.csv', index_col =1)
df1 = df.loc['Output Energy, (Wh/h)'] # choose index value and Average
df1['Average'] = df1.mean(axis=1)
print df1
print df1['Average'].describe()
def hist():
p = sns.distplot(df1['Average'],kde=False, bins=25).set(xlim=(0, 100));
plt.xlabel('Watt hours')
plt.ylabel('Households')
return plt.show()
which returns:
I would like to use three different colors (low, medium, high) to represent higher values on the x =axis with a legend, like this:
EDIT1:
I found this example: here, so I am trying to use this.
I've come up with this:
Which is almost there. How does one split the range into 3, with 3 different colors?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…