I'd like to display the value of the bar on each bar with pyplot.barh()
and ax.bar_label
.
I've read the document https://matplotlib.org/stable/gallery/lines_bars_and_markers/bar_label_demo.html but it didn't help. Please help.
# Prepare & sort the data
df = pd.DataFrame({"coins": ["BTC", "ETH", "BNB", "XRP", "SOL", "ADA"],
"dominance": [42.08, 19.38, 3.68, 1.73, 1.55, 1.51]})
df = df.sort_values(by=["dominance"])
# Plot horizontal bar graph
plt.figure(figsize=[10, 9])
plt.barh(df.coins, df.dominance)