Black Lives Matter. Please consider donating to Black Girls Code today.

Extracting box plot statistics

Hello, I am using go.Box to generate box plots for some data. In addition to the figures, I would to save the statistical information that shows up on the hover including quartile information, median, mean, number of outliers, etc. I’ve looked but been unable to locate this information. Any help in resolving this issue would be greatly appreciated.


Welcome to the forum @arajan
What do you mean you would like to SAVE the statistical information that shows up on the hover? Where do you want to save it?

1 Like

Hi @arajan you cannot have Javascript communicate back to Python the values of the quantiles (this computation is made in Javascript), but you can precompute them using the various methods of scipy.stats (scoreatpercentile, iqr, etc) and then pass them to go.Box as in this example

1 Like

Thanks for the replies :slight_smile:.

@adamschroeder the idea was to save and display the statistics in a table underneath the plots themselves. In addition to displaying the interactive plots, the work flow I have designed involves printing the plots to PDF.

@Emmanuelle thanks for this suggestion. I had seen this option, but wasn’t sure if there was an in-built solution. Thanks, I was able to resolve the issue using your solution.