There are many bar plot questions of similar question here in stackoverflow, but none of them completely answer the question.
I have a pandas dataframe and want to use pandas bar plot with increasing hue of given color (e.g. Blue, Red).
Here is my code:
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import seaborn as sns
df = pd.DataFrame({'count': {0: 3372, 1: 68855, 2: 17948, 3: 708, 4: 9117}})
norm = plt.Normalize(0, df["count"].values.max())
colors = plt.cm.Blues(norm(df["count"].values))
df.plot(kind='bar', color=colors);
Required
Slightly blue color to lowest value.
Darkest blue color to maximum value.
Related questions:
How to give a pandas/matplotlib bar graph custom colors
Change colours of Pandas bar chart