{"id":24653,"library":"statannot","title":"statannot","description":"A Python library to add statistical annotations (e.g., p-value brackets) on existing boxplots/barplots generated by seaborn. Current version 0.2.3, supports Python >=3.5. Maintenance mode; last release in 2020.","status":"maintenance","version":"0.2.3","language":"python","source_language":"en","source_url":"https://github.com/webermarcolivier/statannot","tags":["seaborn","statistics","annotation","boxplot","barplot","p-value"],"install":[{"cmd":"pip install statannot","lang":"bash","label":"PyPI install"}],"dependencies":[{"reason":"Required for plotting, statannot operates on seaborn axes","package":"seaborn","optional":false},{"reason":"Required for plotting and annotation rendering","package":"matplotlib","optional":false},{"reason":"Required for statistical tests","package":"scipy","optional":false},{"reason":"Required for data handling","package":"pandas","optional":false}],"imports":[{"note":"Direct import of the module does not expose the main function; use explicit import of add_stat_annotation.","wrong":"import statannot","symbol":"statannot","correct":"from statannot import add_stat_annotation"}],"quickstart":{"code":"import seaborn as sns\nimport matplotlib.pyplot as plt\nfrom statannot import add_stat_annotation\n\ndf = sns.load_dataset(\"tips\")\nax = sns.boxplot(x=\"day\", y=\"total_bill\", data=df)\nadd_stat_annotation(ax, data=df, x=\"day\", y=\"total_bill\",\n                    test='t-test_ind', comparisons_correction=None,\n                    box_pairs=[(\"Thur\", \"Fri\"), (\"Thur\", \"Sat\")],\n                    text_format='star', verbose=0)\nplt.show()","lang":"python","description":"Add statistical annotation (p-value brackets) to a seaborn boxplot."},"warnings":[{"fix":"Switch to statannotations: pip install statannotations, import from statannotations.","message":"Library is in maintenance mode, no updates since 2020. Consider using statannotations (note the 's' at the end) which is actively maintained.","severity":"deprecated","affected_versions":">=0.2.0"},{"fix":"Ensure exact string matching of category names; use df['column'].unique() to verify.","message":"The 'box_pairs' parameter requires tuples of category names (strings) exactly as they appear in the data. Mismatched case or whitespace will silently produce no annotations.","severity":"gotcha","affected_versions":"all"},{"fix":"Replace pvalue_format='star' with text_format='star'.","message":"As of v0.2.0, the API changed: 'text_format' replaced 'pvalue_format' and 'verbose' parameter was added. If upgrading from <0.2.0, update function calls.","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Use one of the supported tests: 't-test_ind', 't-test_paired', 'Mann-Whitney', 'Mann-Whitney-gt', 'Mann-Whitney-ls', 'Wilcoxon', 'Kruskal', 'ANOVA', 'Kruskal_Dunn'.","message":"The 'test' parameter is case-sensitive. 't-test_ind' works, 't-test' does not. Incorrect values raise ValueError without a clear message.","severity":"gotcha","affected_versions":"all"},{"fix":"Use comparisons_correction=None or 'Bonferroni' only.","message":"The 'comparisons_correction' parameter only accepts None or 'Bonferroni'. Using any other string will not raise an error but will be ignored.","severity":"gotcha","affected_versions":">=0.2.3"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install correct package: pip install statannot, then import from statannot (not statannotations).","cause":"The module name is 'statannot' (no 's' at the end). If the community fork 'statannotations' is installed, the import path differs.","error":"from statannot import add_stat_annotation\nImportError: cannot import name 'add_stat_annotation'"},{"fix":"Replace 'pvalue_format' with 'text_format' in the function call.","cause":"Using old argument name 'pvalue_format' which was renamed to 'text_format' in v0.2.0.","error":"TypeError: add_stat_annotation() got an unexpected keyword argument 'pvalue_format'"},{"fix":"Use a valid test string: 't-test_ind', 't-test_paired', 'Mann-Whitney', etc.","cause":"The 'test' parameter value is not an exact match to the supported test strings.","error":"ValueError: Invalid test name: t-test"},{"fix":"Manually set y-axis limits after adding annotations: ax.set_ylim(top=max_y + some_buffer).","cause":"The library does not automatically adjust y-limits. Annotations may be placed at y-values beyond the current axis limits.","error":"Annotation appears incorrectly placed or off the chart"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}