I have a pandas dataframe with positive and negative values and want to plot it as a bar chart.
I want to plot the positive colors 'green' and the negative values 'red' (very original...lol).
I'm not sure how to pass if > 0 'green' else < 0 'red'?
data = pd.DataFrame([[-15], [10], [8], [-4.5]],
index=['a', 'b', 'c', 'd'],
columns=['values'])
data.plot(kind='barh')
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…