Socket
Socket
Sign inDemoInstall

statannot

Package Overview
Dependencies
0
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    statannot

add statistical annotations on an existing boxplot/barplot generated by seaborn.


Maintainers
1

Readme

What is it

Python package to optionnally compute statistical test and add statistical annotations on an existing boxplot/barplot generated by seaborn.

Features

  • Single function to add statistical annotations on an existing boxplot/barplot generated by seaborn boxplot.
  • Integrated statistical tests (binding to scipy.stats methods):
    • Mann-Whitney
    • t-test (independent and paired)
    • Welch's t-test
    • Levene test
    • Wilcoxon test
    • Kruskal-Wallis test
  • Smart layout of multiple annotations with correct y offsets.
  • Annotations can be located inside or outside the plot.
  • Format of the statistical test annotation can be customized: star annotation, simplified p-value, or explicit p-value.
  • Optionally, custom p-values can be given as input. In this case, no statistical test is performed.

Installation

The latest stable release can be installed from PyPI:

pip install statannot

You may instead want to use the development version from Github:

pip install git+https://github.com/webermarcolivier/statannot.git

Documentation

See example jupyter notebook example/example.ipynb.

Usage

Here is a minimal example:

import seaborn as sns
from statannot import add_stat_annotation

df = sns.load_dataset("tips")
x = "day"
y = "total_bill"
order = ['Sun', 'Thur', 'Fri', 'Sat']
ax = sns.boxplot(data=df, x=x, y=y, order=order)
test_results = add_stat_annotation(ax, data=df, x=x, y=y, order=order,
                                   box_pairs=[("Thur", "Fri"), ("Thur", "Sat"), ("Fri", "Sun")],
                                   test='Mann-Whitney', text_format='star',
                                   loc='outside', verbose=2)
test_results

More examples are available in the jupyter notebook example/example.ipynb.

Examples

Example 1

Example 2

Requirements

  • Python >= 3.5
  • numpy >= 1.12.1
  • seaborn >= 0.8.1
  • matplotlib >= 2.2.2
  • pandas >= 0.23.0
  • scipy >= 1.1.0

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc