Skip to main content

Visualize statistical significance on existing Matplotlib plots by adding

Project description

✨ 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.

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.
  • bar_margin: Margin of the bar from data. Default is 3% of the data.
  • tip_length: Length of the tip of the statistical bar. Default is 3% relative to data range.
  • fontsize: Font size of the annotations.
  • top_margin: Margin of the last annotation from the top of the graph. Default is 3% of the data.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

starbars-1.0.1.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

starbars-1.0.1-py2.py3-none-any.whl (3.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file starbars-1.0.1.tar.gz.

File metadata

  • Download URL: starbars-1.0.1.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for starbars-1.0.1.tar.gz
Algorithm Hash digest
SHA256 78f7cfb8a6f3ba20ca86494aa84b2ba09870d0e0c5948d004397e3f11c131f11
MD5 c25c4fbd76f5d728a32da73864846eed
BLAKE2b-256 cef820081f90a8ff469a360d5b00ef2d36228a6ea952461ad98c22094210188f

See more details on using hashes here.

File details

Details for the file starbars-1.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: starbars-1.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for starbars-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 943cb95e13ede599d09b5b8d67da8f98afa60407d46fcc13b7bd8b145107b2a4
MD5 9e9da39b109fb9166dd6f5e1a046ccd4
BLAKE2b-256 af6d7246e2e5de068e99cbd3766f19aa6c29fe6e373af045adb3f7e50ee44626

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page