✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🧬 Learn how to build RNA-Seq data apps with Python & Dash. Register for the May 20 Webinar!

How to add individual annotation to bar animation chart?

Hello folks,

I have a pandas dataframe with several columns.

In order to have homogeneous data (since each column starts with a diferent number) I have calculated new columns with percentage changes. The columns with percentage changes (percentageA, percentageB) are what I use to compute the lenght of the bars in the chart, that is good because I see relative changes between different columns and the lenght of the bars tell me how much each column changed.

The problem is that I would like to see somewhere the original data stored in columns A and B but I am not able to show it. I have read different things but it all worked for horizontal data, not for vertical data as I have.

The closest thing I found is this:

But his data is not vertical and I don’t understand his code.

Is there any simple way to do this in Plotly express?

I have gone to the API of plotly bar charts and I found the “text” function, but I couldn’t make it work.

So this is my question, How could I tell the text function that it shows values in column “A” over the bar calculated with column “percentageA”, same for “B” and column “percentageB”.

In other words, How to show numbers in one column over a bar that has been computed with a different column?