statannotations icon indicating copy to clipboard operation
statannotations copied to clipboard

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

Open z626093820 opened this issue 6 months ago • 1 comments

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!

z626093820 avatar Jan 02 '24 09:01 z626093820

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

trevismd avatar Jan 02 '24 09:01 trevismd