Skip to main content

✨ starbars ✨

This Python tool helps visualizing statistical significance on existing Matplotlib plots by adding significance bars and p-value labels between chosen pairs of columns.

Example plot

Features

  • Converts p-values to asterisk notations for easy interpretation.
  • Draws statistical significance bars on Matplotlib plots.
  • Customizable bar margins, tip lengths, font sizes, and top margins.

Installation

You can install the package via pip:

pip install starbars

Example

import starbars
import matplotlib.pyplot as plt

# Example data
categories = ['A', 'B', 'C']
values = [10, 20, 15]
annotations = [('A', 'B', 0.01), ('B', 'C', 0.05)]
plt.bar(categories, values)

# Annotate significance
starbars.draw_annotation(annotations)

plt.show()

This example creates a simple bar plot and uses the draw_annotation function to add statistical significance annotations between the specified pairs. For more detailed examples, please check the example.

Parameters

  • annotations: List of tuples (x1, x2, p) containing the x-axis labels and the p-value of the pair.
  • ns_show: Whether to show bars for non-statistical p-values. (Default: True)
  • ax: The axis of subplots to draw annotations on. If ax is not provided, it implies that you are working with a single plot rather than a set of subplots. In such cases, the annotations apply to the only existing plot in the figure. (Default: None)
  • bar_gap: Gap in between the bars of data. Default is 3% of the y-axis.
  • tip_length: Length of the tip of the statistical bar. Default is 3% of the y-axis.
  • top_margin: Margin of the last annotation from the top of the graph. Default is 5% of the y-axis.
  • text_distance: Distance between the bar and the text. Default is 2% of the y-axis.
  • fontsize: Font size of the annotations. Default is 10.

Contributing

We welcome contributions! If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".

To contribute:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Commit your changes (git commit -m 'Add some amazing feature').
  4. Push to the branch (git push origin feature-branch)
  5. Open a pull request

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Metadata

Release files for starbars 3.1.1

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

Source distribution (sdist)

Source distribution for starbars 3.1.1
File Size Uploaded Provenance
starbars-3.1.1.tar.gz 190.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for starbars 3.1.1
File Interpreter ABI Platform
starbars-3.1.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 197.6 kB

Release files / starbars-3.1.1.tar.gz

Download URL starbars-3.1.1.tar.gz
Size 190.2 kB
Tags Source
SHA-256 checksum
How to use checksums
25d7a7716bb9075693ee0f1d06c824ddffc7b8e24005bff3b0926b2ee89bae40
BLAKE2b-256 checksum
How to use checksums
ea0695ffa2feca889a88fc72376d18743ba9b4ec5e5ba98780c7b44055627c3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release files / starbars-3.1.1-py2.py3-none-any.whl

Download URL starbars-3.1.1-py2.py3-none-any.whl
Size 7.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
62cb795dbec11e627ed6b790e017bec0af19039115a02c06e17f8df678085480
BLAKE2b-256 checksum
How to use checksums
4f23e10a51e7991f4db3fbbbaac3183ec632c5977407e660c277c089d6efe1be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Security for starbars 3.1.1

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.

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