python - How to fill matplotlib bars with a gradient? -
i interested in filling matplotlib/seaborn bars of barplot different gradients done here (not matplotlib far understood): 
i have checked related topic pyplot: vertical gradient fill under curve?.
is possible via gr-framework:
or there alternative strategies?
i using seaborn barplot palette option. imagine have simple dataframe like:
df = pd.dataframe({'a':[1,2,3,4,5], 'b':[10,5,2,4,5]}) using seaborn:
sns.barplot(df['a'], df['b'], palette='blues_d') you can obtain like:
then can play palette option , colormap adding gradient according data like:
sns.barplot(df['a'], df['b'], palette=cm.blues(df['b']*10) obtaining:
hope helps.


Comments
Post a Comment