trevismd / statannotations

add statistical significance annotations on seaborn plots. Further development of statannot, with bugfixes, new features, and a different API.
Other
619 stars 67 forks source link

How to keep two decimal places with text_format='full' #142

Open z626093820 opened 6 months ago

z626093820 commented 6 months ago

After I use annotator.configure(test='t-test_ind', text_format='full') to calculate the p-value, how can I round it to two decimal places."

THANK YOU!

trevismd commented 6 months ago

Hi! You can configure pvalue_format_string as you wish. For example, for 2 decimal places in scientific notation,

annotator.configure(test='t-test_ind', text_format='full', pvalue_format_string='{:.2e}')

Which overrides the default defined in https://github.com/trevismd/statannotations/blob/8f148c16944a708dd3d68c9ec4e2772c972fc403/statannotations/PValueFormat.py#L33