pltstat: A Python Library for Statistical Data Visualization
pltstat is a Python library designed to facilitate the visualization of statistical data analysis. This library includes a variety of tools and methods to streamline data exploration, statistical computation, and graphical representation.
Installation
Requirements
pltstat supports Python 3.10 to 3.14. Every release is tested against
each of these versions.
You can check your Python version by running:
python --version
You can download Python from the official Python website.
Installation
To install the pltstat library, simply run the following command:
pip install pltstat
This will install the library along with all the required dependencies as specified in the requirements.txt file.
After installation the package, you can start using pltstat by importing the necessary modules in your Python scripts.
File Descriptions
Python Modules
-
- Marks the directory as a Python package. This file allows you to import modules from the
pltstatpackage.
- Marks the directory as a Python package. This file allows you to import modules from the
-
- Manages the global rendering engine selection (
matplotliborplotly) throughset_backend,get_backend, and thebackendcontext manager.
- Manages the global rendering engine selection (
-
- Dedicated to the analysis and visualization of single-variable features, including plotting functions such as pie charts, count plots, and histograms.
-
- Provides tools for analyzing interactions between two features. Includes functions for creating crosstabs, computing correlations, and visualizing results using violin plots, boxplots, and distribution box plots. These functions also display p-values and other statistical metrics to summarize relationships between the two features.
-
- Provides tools for analyzing relationships between multiple features.
Includes visualization functions for analyzing missing data, comparing distributions, and visualizing dimensionality reductions. Additionally, it provides methods for creating heatmaps that display correlations and p-values, including Spearman's correlation, Mann-Whitney p-values, and Phik correlations.
- Provides tools for analyzing relationships between multiple features.
-
- Contains functions and methods related to circular statistical visualizations, such as radar charts or circular histograms.
-
- Contains custom colormap utilities for visualizations, such as rendering correlation matrices or creating two-colored maps for p-values with a threshold (e.g., alpha).
-
- Includes methods for calculating correlation matrices and related statistical relationships.
-
- Provides utilities for reading, writing, and preprocessing input and output data files.
Other Files
-
- Specifies intentionally untracked files to ignore in the repository, such as virtual environments and temporary files.
-
README.md- This file provides an overview of the project, including file descriptions and usage instructions.
-
- Lists the Python dependencies required to run the library. Install them using:
pip install -r requirements.txt
- Lists the Python dependencies required to run the library. Install them using:
Getting Started
-
Clone the repository:
git clone https://github.com/trojanskehesten/pltstat.git
-
Navigate to the project directory:
cd pltstat
-
Python Version: This library is compatible with Python 3.10 to 3.14. Ensure that one of these versions is installed before running the project.
-
Install dependencies:
pip install -r requirements.txt
-
Run the test suite (optional):
pip install -e ".[test]" pytest
-
Explore the modules and utilize the library in your projects.
Usage
Each module in pltstat is designed to be modular and reusable. Import the required module and use its functions to visualize your statistical data.
Rendering engine
Every plotting function can draw with matplotlib (the default) or with plotly. Choose the engine in either of two ways.
Set it once for the whole session:
import pltstat
from pltstat import singlefeat as sf
pltstat.set_backend("plotly")
fig = sf.pie(df["A/B Test Group"]) # returns a plotly Figure
Or override it for a single call with the engine parameter:
fig = sf.pie(df["A/B Test Group"], engine="plotly")
sf.pie(df["A/B Test Group"], engine="matplotlib") # draws in place
A backend context manager changes the engine for a block only:
with pltstat.backend("plotly"):
fig = sf.pie(df["A/B Test Group"])
With matplotlib the functions draw in place and return None, as before. With
plotly they return a plotly.graph_objects.Figure, which a notebook renders on
its own. The functions which return data, pvals_num, pvals_cat,
pvals_num_cat and dist_qq_plot, keep returning that data with either
engine; pass fig_return=True to get the pair (data, figure).
The ax parameter belongs to matplotlib and is ignored, with a warning, when
the engine is plotly. figsize is converted to pixels at 100 dpi. Keyword
arguments collected by **kwargs reach the underlying call of the engine in
use, so they are engine specific. The output of the two engines is equivalent,
not identical pixel for pixel.
Example 1: Pie Chart
import pandas as pd
from pltstat import singlefeat as sf
data = {
"Age": [25, 30, 22, 27, 35],
"A/B Test Group": ["A", "B", "A", "B", "A"],
}
df = pd.DataFrame(data)
# Plot a pie chart
sf.pie(df["A/B Test Group"])
Result 1
Example 2: Boxplot
import pandas as pd
from pltstat import twofeats as tf
# Data creation:
data = {
"gender": ["male", "female", "female", "male", "male", "female", "female", "male", "male",
"female", "male", "female", "male", "male", "female", "male", "female", "male",
"female", "male", "female", "male", "female", "male", "female", "male", "female",
"female", "male", "male", "male", "male"],
"age": [22, 20, 17, 16, 19, 17, 11, 29, 24, 12, 22, 20, 19, 16, 11, 29, 24, 20, 16, 22,
17, 29, 24, 16, 17, 29, 22, 19, 22, 22, 24, 29]
}
df = pd.DataFrame(data)
# Boxplot creation:
tf.boxplot(df, "gender", "age")
Result 2
Example 3: Boxplot and Distribution Plot
import numpy as np
import pandas as pd
from pltstat import twofeats as tf
# Example DataFrame
np.random.seed(42)
df = pd.DataFrame({
'category': np.random.choice(['A', 'B'], size=100),
'value': np.random.randn(100),
})
# Create a boxplot and a distribution plot
tf.dis_box_plot(df, cat_feat='category', num_feat='value')
Result 3
Contributing
Contributions are welcome! If you'd like to improve the library or fix issues, please:
- Fork the repository.
- Create a new branch.
- Make your changes and commit them.
- Submit a pull request.
License
This project is licensed under the BSD 3-Clause License. See the LICENSE file for details.
Metadata
Release files for pltstat 0.11.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pltstat-0.11.0.tar.gz | 54.6 kB | With provenance | Details for pltstat-0.11.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pltstat-0.11.0-py3-none-any.whl | Python 3 | none | any | Details for pltstat-0.11.0-py3-none-any.whl |
Total release size: 108.0 kB
Release files / pltstat-0.11.0.tar.gz
| Download URL | pltstat-0.11.0.tar.gz |
|---|---|
| Size | 54.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
57a82d832d258a21758357c9ac28b595add3f716a956bf9c8a0a49c482a7f591
|
|
BLAKE2b-256 checksum How to use checksums |
750e0eaecc4399303bdfa0baf5b33ad617abdb40c5a33c9aed6616ed640298f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logRelease files / pltstat-0.11.0-py3-none-any.whl
| Download URL | pltstat-0.11.0-py3-none-any.whl |
|---|---|
| Size | 53.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a1237792764e76fe16d95ae547f8a2405aec6f915e122d2ed5d4b32891ce7caa
|
|
BLAKE2b-256 checksum How to use checksums |
d44d4f2ddec866f85e036bacda923fe979d7aed5ba81048298106d55017e9fd0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logSecurity for pltstat 0.11.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pltstat-0.11.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logA 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.