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.statsmethods):- 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
Requirements
- Python >= 3.5
- numpy >= 1.12.1
- seaborn >= 0.8.1
- matplotlib >= 2.2.2
- pandas >= 0.23.0
- scipy >= 1.1.0
Metadata
Release files for statannot 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| statannot-0.2.3.tar.gz | 705.7 kB | Without provenance | Details for statannot-0.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| statannot-0.2.3-py3-none-any.whl | Python 3 | none | any | Details for statannot-0.2.3-py3-none-any.whl |
Total release size: 716.6 kB
Release files / statannot-0.2.3.tar.gz
| Download URL | statannot-0.2.3.tar.gz |
|---|---|
| Size | 705.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4600c2fa1f682d493a4ad0c1c4501b32a3d8d3a55877ec97bcf4e44fbd160cb9
|
|
BLAKE2b-256 checksum How to use checksums |
2aaf318b1b75808bdeb0aab1d3fc17d4d8242bad712d20e59a6f5ee228495b8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.9
|
Release files / statannot-0.2.3-py3-none-any.whl
| Download URL | statannot-0.2.3-py3-none-any.whl |
|---|---|
| Size | 11.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
17745a40542e157e3f147147425c5da441f62bb698b3644154cedf088d4d0b08
|
|
BLAKE2b-256 checksum How to use checksums |
0f3ae579d7e3b855586e468375251ec093142d67c5f8ccd76482492f2a474862
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.9
|
Security for statannot 0.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.