Skip to main content

Tools for Statistical Plotting

Chen Liu @ Krishnaswamy Lab, Yale University

Latest PyPI version PyPI license PyPI download month PyPI download day made-with-python

Please kindly Star Github Stars this repo for better reach if you find it useful.

Installation

pip install statistical-plot

Example Plots

Statistical Bar Plot

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')

Metadata

Release files for statistical-plot 0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for statistical-plot 0.10
File Size Uploaded
statistical-plot-0.10.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for statistical-plot 0.10
File Interpreter ABI Platform
statistical_plot-0.10-py3-none-any.whl Python 3 none any Details

Total release size: 10.5 kB

Release files / statistical-plot-0.10.tar.gz

Download URL statistical-plot-0.10.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a1883b855522f3d7d5e3a3e3e98dfa1f4891a45487f87b2d89ac30d7448a479b
BLAKE2b-256 checksum
How to use checksums
32605894186aa321b66a3c38b2aca53d6443dd6d244df37943c9de0183a65bfc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.13

Release files / statistical_plot-0.10-py3-none-any.whl

Download URL statistical_plot-0.10-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
efba3e8d871211d824d729724c6266c039fc9ea8270bd706378a8dc8dbdf04e5
BLAKE2b-256 checksum
How to use checksums
832f3395c1dfdcf1e0cace0a28a0dcde78ec5ab105df4c407b2f9b3fcbcef09a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.13

Release history Release notifications | RSS feed

This release

0.10 This release

2 release files

0.9

1 release file

0.8

1 release file

0.7

1 release file

0.5

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page