Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23218

apply different formatting to only one bar label in matplotlib's bar label

$
0
0

I want to apply different formatting to only 1 bar label in matplotlib's bar labels.

Example Code

import pandas as pdimport seaborn as snssns.set_style('white')s = pd.Series({'John': 10000, 'Amy': 5000, 'Elizabeth': 2000, 'James': 3000, 'Roy': 4000})color1 = ['orange', 'lightgrey', 'lightgrey','lightgrey','lightgrey']ax1 = s.plot(kind='barh', color=color1, figsize=(6, 3), width=.8)labels = ax1.bar_label(ax1.containers[0], padding=-10, color='black', fontsize=10)for label in labels:    label.set_ha('right')ax1.set_xticks([])sns.despine(bottom=True, left=True)

enter image description here

I want change John’s bar label to size 20, bold, white color.

also want to utilize s.index to target John.

Which code should I use?

Thank you for all your help!


Viewing all articles
Browse latest Browse all 23218

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>