Question
How to plot justify bar labels to the right side and add a title to the bar labels in Python's matplotlib?
I have created a chart in matplotlib in python, but the last line in the following code doesn't allow alignment of the bar labels outside of the graph.
import matplotlib.pyplot as plt
g=df.plot.barh(x=name,y=days)
g.set_title("Days people showed up")
g.bar_label(g.containers[0], label_type='edge')
I get a graph that looks like:
Days people showed up
-----------------------
Amy |+++ 1 |
Bob |+++++++++++++++ 4 |
Jane |+++++++ 2 |
---|---|---|---|---|---
1 2 3 4 5
Instead I want something like this:
Days people showed up
----------------------- Count
Amy |+++ | 1
Bob |+++++++++++++++ | 4
Jane |+++++++ | 2
---|---|---|---|---|---
1 2 3 4 5
Is it possible to do this? It doesn't seem like it is native in matplotlib as the only options for label_type is edge or center. Is it possible to add a label to the bar labels as well?