✊🏿 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!

Boxplot/violin plot how to add hover data that include number of samples in each group

I’m using plotly express to plot boxplot and violin plots, and use color to differentiate each groups. I wonder how to set up hover data such that when I hover on the boxplot of one particular group, it’s showing me not only the boxplot specific stats, eg. Median, q1, q3 etc, it can also show me the number of samples in each groups. Please advise. Thank you so much!

In my case working with a reasonable large dataset (so plotting individual sample points is turned off), I can get sample count for each added trace through go.Box. However, this works only for outliers in each group. Still looking to add sample count to the hovertemplate (which shows sample min/max/quantiles etc.) when hovering on box/whiskers. Any suggestions greatly appreciated.