## 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:
```python
pip install statannot
```
You may instead want to use the development version from Github:
```python
pip install git+https://github.com/webermarcolivier/statannot.git
```
## Documentation
See example jupyter notebook `example/example.ipynb`.
## Usage
Here is a minimal example:
```python
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
Raw data
{
"_id": null,
"home_page": "https://github.com/webermarcolivier/statannot",
"name": "statannot",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.5",
"maintainer_email": "",
"keywords": "",
"author": "Marc Weber",
"author_email": "webermarcolivier@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/2a/af/318b1b75808bdeb0aab1d3fc17d4d8242bad712d20e59a6f5ee228495b8f/statannot-0.2.3.tar.gz",
"platform": "",
"description": "## What is it\n\nPython package to optionnally compute statistical test and add statistical annotations on an existing boxplot/barplot generated by seaborn.\n\n## Features\n\n- Single function to add statistical annotations on an existing boxplot/barplot generated by seaborn boxplot.\n- Integrated statistical tests (binding to `scipy.stats` methods):\n - Mann-Whitney\n - t-test (independent and paired)\n - Welch's t-test\n - Levene test\n - Wilcoxon test\n - Kruskal-Wallis test\n- Smart layout of multiple annotations with correct y offsets.\n- Annotations can be located inside or outside the plot.\n- Format of the statistical test annotation can be customized: star annotation, simplified p-value, or explicit p-value.\n- Optionally, custom p-values can be given as input. In this case, no statistical test is performed.\n\n## Installation\n\nThe latest stable release can be installed from PyPI:\n\n```python\npip install statannot\n```\nYou may instead want to use the development version from Github:\n\n```python\npip install git+https://github.com/webermarcolivier/statannot.git\n```\n\n## Documentation\n\nSee example jupyter notebook `example/example.ipynb`.\n\n## Usage\n\nHere is a minimal example:\n\n```python\nimport seaborn as sns\nfrom statannot import add_stat_annotation\n\ndf = sns.load_dataset(\"tips\")\nx = \"day\"\ny = \"total_bill\"\norder = ['Sun', 'Thur', 'Fri', 'Sat']\nax = sns.boxplot(data=df, x=x, y=y, order=order)\ntest_results = add_stat_annotation(ax, data=df, x=x, y=y, order=order,\n box_pairs=[(\"Thur\", \"Fri\"), (\"Thur\", \"Sat\"), (\"Fri\", \"Sun\")],\n test='Mann-Whitney', text_format='star',\n loc='outside', verbose=2)\ntest_results\n```\n\nMore examples are available in the jupyter notebook `example/example.ipynb`.\n\n\n## Examples\n\n\n\n\n\n## Requirements\n\n+ Python >= 3.5\n+ numpy >= 1.12.1\n+ seaborn >= 0.8.1\n+ matplotlib >= 2.2.2\n+ pandas >= 0.23.0\n+ scipy >= 1.1.0\n\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "add statistical annotations on an existing boxplot/barplot generated by seaborn.",
"version": "0.2.3",
"project_urls": {
"Homepage": "https://github.com/webermarcolivier/statannot"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0f3ae579d7e3b855586e468375251ec093142d67c5f8ccd76482492f2a474862",
"md5": "f2fb2430d4bac6ed942f5d547e454256",
"sha256": "17745a40542e157e3f147147425c5da441f62bb698b3644154cedf088d4d0b08"
},
"downloads": -1,
"filename": "statannot-0.2.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f2fb2430d4bac6ed942f5d547e454256",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.5",
"size": 10977,
"upload_time": "2020-02-25T12:38:54",
"upload_time_iso_8601": "2020-02-25T12:38:54.853912Z",
"url": "https://files.pythonhosted.org/packages/0f/3a/e579d7e3b855586e468375251ec093142d67c5f8ccd76482492f2a474862/statannot-0.2.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2aaf318b1b75808bdeb0aab1d3fc17d4d8242bad712d20e59a6f5ee228495b8f",
"md5": "8de8747876d60d2e21f95d4296bae324",
"sha256": "4600c2fa1f682d493a4ad0c1c4501b32a3d8d3a55877ec97bcf4e44fbd160cb9"
},
"downloads": -1,
"filename": "statannot-0.2.3.tar.gz",
"has_sig": false,
"md5_digest": "8de8747876d60d2e21f95d4296bae324",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.5",
"size": 705654,
"upload_time": "2020-02-25T12:38:58",
"upload_time_iso_8601": "2020-02-25T12:38:58.036652Z",
"url": "https://files.pythonhosted.org/packages/2a/af/318b1b75808bdeb0aab1d3fc17d4d8242bad712d20e59a6f5ee228495b8f/statannot-0.2.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2020-02-25 12:38:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "webermarcolivier",
"github_project": "statannot",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "statannot"
}