How can I put the text of one of the bars in a stack bar chart outside the whole stack bar chart

Sorry for being so confusing in the header no idea how to write this question.
So I want to go from here:


To here:

While the text you’re seeing is just the text I wrote for the pink bar I will change it in the future to be the value of the pink bar.
Any idea how to do this?

There may be a better way to do it, but my first thought was to add three annotations like this:

fig.add_annotation(y='monkeys', x=100, xanchor='right',
                       showarrow=False, align='left',
                       text='POP',font = {'color':'blue', 'size':12})
fig.add_annotation(y='orangutans', x=100, xanchor='right',
                       showarrow=False, align='left',
                       text='POP',font = {'color':'blue', 'size':12})
fig.add_annotation(y='giraffes', x=100, xanchor='right', 
                       showarrow=False, align='left',
                       text='POP',font = {'color':'blue', 'size':12})

And change ‘POP’ to whatever you need to, obviously.

2 Likes

Thanks that’s a great solution!

2 Likes