Statsplotly is a Python data visualization library based on Plotly. It provides a high-level interface for drawing interactive statistical data visualization plots with a tidy, declarative API.
Philosophy
I began to work on this library during my first job outside academia, a few months before the fantastic plotly.express API was launched. I was looking for a solution to generate visually appealing statistical plots that adapt well to diverse communication mediums, such as web applications, Jupyter Notebooks, presentations, and printed reports.
There are multiple declarative visualization library in the Python ecosystem, each with their own strengths, but none really fit my needs at the time.
Further, I discovered that real-world data analysis, whether in academia or industry, is rarely about creating facet plots. Instead, it revolves around crafting the most effective graphical representation to achieve one of two primary objectives:
- Exploratory data visualization: the ideal tool should facilitate effortless immersion into the data to uncover valuable insights.
- Explanatory data visualization: the ideal tool should enable rapid creation of polished, visually appealing plots that effectively support a hypothesis derived from the preceding analysis.
There is no reason these two endeavours should require different workflows. On the contrary, working towards both ends using the same tool should increase both analysis and communication efficiency.
I thus set out to design a library combining :
-
a high level interface with graphical representation entities (e.g., plot, barplot, distplot, etc) as entrypoint functions. As intellectually satisfying the Grammar of Graphics may be, I find this framework to be quite convoluted for expressing pragmatic visualization needs one has when performing real-world data analysis.
-
a mainly declarative, yet chainable and customizable by imperative workflow, API. Assembling the appropriate data visualization units across a flexible combination of facets requires keeping control over the different layers of the graphical representations.
-
A genuinely interactive plotting interface: In the realm of data visualization beyond scientific publishing, the primary objectives are to explore and convey insights about a phenomenon, business metrics, or a model's performance. This requires a responsive graphic engine allowing for dynamic visualization.
statsplotly key standout features are :
- an independent processing of color coding scheme, data slicer and plot dimensions.
- a high level interface for seaborn-like visualization of data distributions.
- statistical data processing under the hood.
- leveraging of the tidy DataFrame structure for easy styling of plot cues (e.g., marker color, symbol, size, and opacity).
- sensible cartesian and coloraxis coordinates management across figure subplots.
In summary, statsplotly seeks to take advantage of the powerful interactivity offered by plotly.js without compromising statistical intelligibility for aesthetic choices, or vice-versa.
Documentation
Main features and details of the public API can be found in the documentation.
Installation
Using Pip
pip install statsplotly
Development
Using Poetry
First make sure you have Poetry installed on your system (see instruction).
Then, assuming you have a Unix shell with make, create and set up a new Poetry environment :
make init
To make the Poetry-managed kernel available for a globally installed Jupyter :
poetry run python -m ipykernel install --user --name=<KERNEL_NAME>
jupyter notebook
On the Jupyter server, select the created kernel in “Kernel” -> “Change kernel”.
Dissecting Makefile
The Makefile provides several targets to assist in development and code quality :
initcreates a project-specific virtual environment and installs the dependencies of thepoetry.lockfile.cilaunches Ruff, mypy and pytest on your source code.pre-commitset up and run pre-commit hooks (see pre-commit documentation).update-docandbuild-docgenerates documentation from source code and builds it with Sphinx.coveragegenerates code coverage report.cleanclears bytecode,poetry/pipcaches andpre-commithooks. Use with caution.
Requirements
Author
Release files for statsplotly 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| statsplotly-0.3.2.tar.gz | 51.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| statsplotly-0.3.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 121.5 kB
Release files / statsplotly-0.3.2.tar.gz
| Download URL | statsplotly-0.3.2.tar.gz |
|---|---|
| Size | 51.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c0fd21b19422bb9b6e8d659796071831d594345bac7fd9c2058901301e07184c
|
|
BLAKE2b-256 checksum How to use checksums |
62137a18d92a22e612042c4791cd4b4de54b8c9f0f0ded1008475a7e40a20371
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.14.4 Linux/6.17.0-1010-azure
|
Release files / statsplotly-0.3.2-py3-none-any.whl
| Download URL | statsplotly-0.3.2-py3-none-any.whl |
|---|---|
| Size | 69.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1aecea291a2d922b6230bc6126f7132f0d1ed7a45b8bdbaca33f5560ed220dd8
|
|
BLAKE2b-256 checksum How to use checksums |
58e5368dacc6c15ceed568a63ea75428ca715b72799ea86495f319e1cf1bd4cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.14.4 Linux/6.17.0-1010-azure
|