DEV Community

loading...

Discussion on: Stacked and Grouped Bar Charts Using Plotly (Python)

Collapse
hemakiranyadla profile image
HEMA KIRAN

Here features of model 2 are 11 but while hovering the column it shows 15 i.e. the sum of model 1 features (4) and model 2 features(11)!! How to show only the number of features of model 2 in hovering template ??

Collapse
fronkan profile image
Fredrik Bengtsson Author

I tried to find a solution using the hovertemplate parameter, but I couldn't find how to access the actual value. However, I found one solution using hovertext= [f'Count: {val}' for val in data["model_2"]] for the Model 2 bar chart. This adds a row to the hove with Count: where value is the actual data value.