# Tools for Statistical Plotting
**Chen Liu** @ [Krishnaswamy Lab](https://krishnaswamylab.org/members), Yale University
[![Latest PyPI version](https://img.shields.io/pypi/v/statistical-plot.svg)](https://pypi.org/project/statistical-plot/)
[![PyPI license](https://img.shields.io/pypi/l/statistical-plot.svg)](https://pypi.python.org/pypi/statistical-plot/)
[![PyPI download month](https://img.shields.io/pypi/dm/statistical-plot.svg)](https://pypi.python.org/pypi/statistical-plot/)
[![PyPI download day](https://img.shields.io/pypi/dd/statistical-plot.svg)](https://pypi.python.org/pypi/statistical-plot/)
[![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/)
Please kindly **Star** [![Github Stars](https://img.shields.io/github/stars/ChenLiu-1996/StatsPlot.svg?style=social&label=Stars)](https://github.com/ChenLiu-1996/StatsPlot/) this repo for better reach if you find it useful.
## Installation
```
pip install statistical-plot
```
## Example Plots
### Statistical Bar Plot
<img src="assets/sbplot_example.png" height="300"/>
## Usage
### Statistical Bar Plot
```
from statistical_plot import sbplot
fig = plt.figure(figsize=(12, 6))
ax = fig.add_subplot(1, 2, 1)
np.random.seed(1)
method_list = ['method_1', 'method_2', 'method_3']
auroc_data_dict = {
'method_1': np.clip(np.random.normal(loc=0.92, scale=0.04, size=(10,)), 0, 1),
'method_2': np.clip(np.random.normal(loc=0.75, scale=0.03, size=(10,)), 0, 1),
'method_3': np.clip(np.random.normal(loc=0.98, scale=0.02, size=(10,)), 0, 1),
}
auroc_pvals_dict = {
'method_1 vs method_3': 0.01,
'method_2 vs method_3': 5e-5,
}
acc_data_dict = {
'method_1': np.clip(np.random.normal(loc=0.89, scale=0.05, size=(10,)), 0, 1),
'method_2': np.clip(np.random.normal(loc=0.81, scale=0.04, size=(10,)), 0, 1),
'method_3': np.clip(np.random.normal(loc=0.94, scale=0.03, size=(10,)), 0, 1),
}
acc_pvals_dict = {
'method_1 vs method_3': 0.01,
'method_2 vs method_3': 0.001,
}
f1_data_dict = {
'method_1': np.clip(np.random.normal(loc=0.92, scale=0.04, size=(10,)), 0, 1),
'method_2': np.clip(np.random.normal(loc=0.87, scale=0.03, size=(10,)), 0, 1),
'method_3': np.clip(np.random.normal(loc=0.95, scale=0.02, size=(10,)), 0, 1),
}
f1_pvals_dict = {
'method_1 vs method_3': 0.01,
'method_2 vs method_3': 3e-4,
}
plt.rcParams['font.family'] = 'serif'
plt.rcParams['legend.fontsize'] = 12
fig = plt.figure(figsize=(14, 6))
ax = fig.add_subplot(1, 3, 1)
ax = sbplot(ax=ax, method_list=method_list, data_dict=auroc_data_dict, pvals_dict=auroc_pvals_dict, ymin=0)
ax.set_ylabel('AUROC', fontsize=18)
ax = fig.add_subplot(1, 3, 2)
ax = sbplot(ax=ax, method_list=method_list, data_dict=acc_data_dict, pvals_dict=acc_pvals_dict, ymin=0)
ax.set_ylabel('Accuracy', fontsize=18)
ax = fig.add_subplot(1, 3, 3)
ax = sbplot(ax=ax, method_list=method_list, data_dict=f1_data_dict, pvals_dict=f1_pvals_dict, ymin=0)
ax.set_ylabel('F1 Score', fontsize=18)
fig.tight_layout(pad=1)
fig.savefig('./sbplot_example.png')
```
Raw data
{
"_id": null,
"home_page": "https://github.com/ChenLiu-1996/StatsPlot",
"name": "statistical-plot",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "plotting,plot,statistical plotting,statistical plot",
"author": "Chen Liu",
"author_email": "chen.liu.cl2482@yale.edu",
"download_url": "https://files.pythonhosted.org/packages/a3/9c/29065cd3868e93a1e5ed5c4ff9990a50d89f0a7d3e691891ecd7639086e7/statistical-plot-0.9.tar.gz",
"platform": null,
"description": "# Tools for Statistical Plotting\n\n**Chen Liu** @ [Krishnaswamy Lab](https://krishnaswamylab.org/members), Yale University\n\n[![Latest PyPI version](https://img.shields.io/pypi/v/statistical-plot.svg)](https://pypi.org/project/statistical-plot/)\n[![PyPI license](https://img.shields.io/pypi/l/statistical-plot.svg)](https://pypi.python.org/pypi/statistical-plot/)\n[![PyPI download month](https://img.shields.io/pypi/dm/statistical-plot.svg)](https://pypi.python.org/pypi/statistical-plot/)\n[![PyPI download day](https://img.shields.io/pypi/dd/statistical-plot.svg)](https://pypi.python.org/pypi/statistical-plot/)\n[![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/)\n\nPlease kindly **Star** [![Github Stars](https://img.shields.io/github/stars/ChenLiu-1996/StatsPlot.svg?style=social&label=Stars)](https://github.com/ChenLiu-1996/StatsPlot/) this repo for better reach if you find it useful.\n\n## Installation\n```\npip install statistical-plot\n```\n\n## Example Plots\n### Statistical Bar Plot\n\n<img src=\"assets/sbplot_example.png\" height=\"300\"/>\n\n\n\n## Usage\n### Statistical Bar Plot\n\n```\nfrom statistical_plot import sbplot\nfig = plt.figure(figsize=(12, 6))\nax = fig.add_subplot(1, 2, 1)\n\nnp.random.seed(1)\n\nmethod_list = ['method_1', 'method_2', 'method_3']\n\nauroc_data_dict = {\n 'method_1': np.clip(np.random.normal(loc=0.92, scale=0.04, size=(10,)), 0, 1),\n 'method_2': np.clip(np.random.normal(loc=0.75, scale=0.03, size=(10,)), 0, 1),\n 'method_3': np.clip(np.random.normal(loc=0.98, scale=0.02, size=(10,)), 0, 1),\n}\nauroc_pvals_dict = {\n 'method_1 vs method_3': 0.01,\n 'method_2 vs method_3': 5e-5,\n}\n\nacc_data_dict = {\n 'method_1': np.clip(np.random.normal(loc=0.89, scale=0.05, size=(10,)), 0, 1),\n 'method_2': np.clip(np.random.normal(loc=0.81, scale=0.04, size=(10,)), 0, 1),\n 'method_3': np.clip(np.random.normal(loc=0.94, scale=0.03, size=(10,)), 0, 1),\n}\nacc_pvals_dict = {\n 'method_1 vs method_3': 0.01,\n 'method_2 vs method_3': 0.001,\n}\n\nf1_data_dict = {\n 'method_1': np.clip(np.random.normal(loc=0.92, scale=0.04, size=(10,)), 0, 1),\n 'method_2': np.clip(np.random.normal(loc=0.87, scale=0.03, size=(10,)), 0, 1),\n 'method_3': np.clip(np.random.normal(loc=0.95, scale=0.02, size=(10,)), 0, 1),\n}\nf1_pvals_dict = {\n 'method_1 vs method_3': 0.01,\n 'method_2 vs method_3': 3e-4,\n}\n\nplt.rcParams['font.family'] = 'serif'\nplt.rcParams['legend.fontsize'] = 12\nfig = plt.figure(figsize=(14, 6))\nax = fig.add_subplot(1, 3, 1)\nax = sbplot(ax=ax, method_list=method_list, data_dict=auroc_data_dict, pvals_dict=auroc_pvals_dict, ymin=0)\nax.set_ylabel('AUROC', fontsize=18)\n\nax = fig.add_subplot(1, 3, 2)\nax = sbplot(ax=ax, method_list=method_list, data_dict=acc_data_dict, pvals_dict=acc_pvals_dict, ymin=0)\nax.set_ylabel('Accuracy', fontsize=18)\n\nax = fig.add_subplot(1, 3, 3)\nax = sbplot(ax=ax, method_list=method_list, data_dict=f1_data_dict, pvals_dict=f1_pvals_dict, ymin=0)\nax.set_ylabel('F1 Score', fontsize=18)\n\nfig.tight_layout(pad=1)\nfig.savefig('./sbplot_example.png')\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Statistical plotting with good aesthetics.",
"version": "0.9",
"project_urls": {
"Homepage": "https://github.com/ChenLiu-1996/StatsPlot"
},
"split_keywords": [
"plotting",
"plot",
"statistical plotting",
"statistical plot"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a39c29065cd3868e93a1e5ed5c4ff9990a50d89f0a7d3e691891ecd7639086e7",
"md5": "c72f04b93191db83f4b41900ffb8bca4",
"sha256": "5f73459ac5f3a903592cdc98c6b644def99d5cc76ac7ba411909b8db83df4423"
},
"downloads": -1,
"filename": "statistical-plot-0.9.tar.gz",
"has_sig": false,
"md5_digest": "c72f04b93191db83f4b41900ffb8bca4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5001,
"upload_time": "2024-01-18T22:32:35",
"upload_time_iso_8601": "2024-01-18T22:32:35.757045Z",
"url": "https://files.pythonhosted.org/packages/a3/9c/29065cd3868e93a1e5ed5c4ff9990a50d89f0a7d3e691891ecd7639086e7/statistical-plot-0.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-18 22:32:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ChenLiu-1996",
"github_project": "StatsPlot",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "statistical-plot"
}