Extension package for plotnine with extra geoms, stats, composition, and animation
Project description
plotnine-extra
Extension package for plotnine that adds extra geoms, stats, plot composition, and animation support.
Installation
pip install plotnine-extra
This will automatically install plotnine as a dependency.
Usage
from plotnine_extra import *
This imports all of plotnine's public API plus the extra components provided by this package. You can also import from plotnine and plotnine_extra separately:
from plotnine import ggplot, aes, geom_point
from plotnine_extra import geom_pointdensity, annotation_stripes
Extra Components
Geoms
geom_pointdensity— Scatterplot with density estimation at each pointgeom_spoke— Line segments parameterised by location, direction, and distanceannotation_stripes— Alternating background stripes, useful withgeom_jitter
Stats
stat_pointdensity— Compute density estimation for each point
Plot Composition
Compose multiple plots using operators:
|— Arrange plots side by side (Beside)/— Arrange plots vertically (Stack)+— Arrange plots in a 2D grid (Wrap)-— Arrange plots side by side at the same nesting level&— Add to all plots in a composition*— Add to top-level plots only
from plotnine import ggplot, aes, geom_point
from plotnine.data import mtcars
from plotnine_extra import plot_layout, plot_annotation
p1 = ggplot(mtcars, aes("wt", "mpg")) + geom_point()
p2 = ggplot(mtcars, aes("hp", "mpg")) + geom_point()
# Side by side
p1 | p2
# Stacked
p1 / p2
# With layout control
(p1 | p2) + plot_layout(widths=[1, 2])
# With annotation
(p1 | p2) + plot_annotation(title="My Composition")
Additional composition classes and functions:
Compose— Base class for compositionsBeside,Stack,Wrap— Composition subclassesplot_layout— Customise composition layout (nrow, ncol, widths, heights)plot_annotation— Add title, subtitle, caption, footer to compositionsplot_spacer— Add blank space in compositions
Animation
from plotnine import ggplot, aes, geom_point, lims
from plotnine_extra import PlotnineAnimation
plots = [
ggplot(data_frame_i, aes("x", "y")) + geom_point() + lims(x=(0, 10), y=(0, 10))
for data_frame_i in frames
]
ani = PlotnineAnimation(plots, interval=200)
ani.save("animation.gif")
Compatibility
- Requires Python ≥ 3.10
- Requires plotnine ≥ 0.15.3
Note: The composition and animation modules use plotnine's internal APIs and may break with future plotnine updates. Pin your plotnine version if stability is critical.
Development
git clone https://github.com/mdmanurung/plotnine-extra.git
cd plotnine-extra
pip install -e ".[all]"
Publishing to PyPI
This project uses trusted publishing (OIDC) via GitHub Actions — no API tokens needed.
One-time setup
-
Add trusted publishers on both PyPI and TestPyPI:
- Go to your account → Publishing → Add a new pending publisher
- Fill in:
- PyPI project name:
plotnine-extra - Owner:
mdmanurung - Repository:
plotnine-extra - Workflow name:
publish.yml - Environment name:
pypi(for PyPI) ortestpypi(for TestPyPI)
- PyPI project name:
-
Create GitHub environments in your repository settings:
- Go to Settings → Environments
- Create two environments:
pypiandtestpypi
How to publish
- To TestPyPI: Go to Actions → "Publish to PyPI / TestPyPI" → Run workflow → select
testpypi - To PyPI: Create a GitHub Release (tag it as
v0.1.0, etc.) — publishing happens automatically
Version bumping
Before publishing a new version, update the version in both:
pyproject.toml→version = "X.Y.Z"plotnine_extra/__init__.py→__version__ = "X.Y.Z"
License
MIT License (same as plotnine)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file plotnine_extra-0.2.0.tar.gz.
File metadata
- Download URL: plotnine_extra-0.2.0.tar.gz
- Upload date:
- Size: 97.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a72725dda5d60b4de9eef88e8032c8b8c0631c42bca7ba5b2990574c2c3b2917
|
|
| MD5 |
39d8429bd0613d7179c42440c804ef6d
|
|
| BLAKE2b-256 |
56e055c3037a54934d3bd59877d0e576c91bb6031984910eec3909385dcac001
|
Provenance
The following attestation bundles were made for plotnine_extra-0.2.0.tar.gz:
Publisher:
publish.yml on mdmanurung/plotnine-extra
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
plotnine_extra-0.2.0.tar.gz -
Subject digest:
a72725dda5d60b4de9eef88e8032c8b8c0631c42bca7ba5b2990574c2c3b2917 - Sigstore transparency entry: 1247294282
- Sigstore integration time:
-
Permalink:
mdmanurung/plotnine-extra@a3e6b248d2e198ead1057fbd251138be9ed1f4f5 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/mdmanurung
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a3e6b248d2e198ead1057fbd251138be9ed1f4f5 -
Trigger Event:
release
-
Statement type:
File details
Details for the file plotnine_extra-0.2.0-py3-none-any.whl.
File metadata
- Download URL: plotnine_extra-0.2.0-py3-none-any.whl
- Upload date:
- Size: 114.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6da040fadb3e4f81633502c8f042b99f5a798eac8159dd1fe93946e50ce15dd
|
|
| MD5 |
09516d5b411cde3d0540670cf73a1af6
|
|
| BLAKE2b-256 |
57ac846842984e2b2c8ef6bef46ad96b6f8caf32844ed0fb05d7f7c4bdf37211
|
Provenance
The following attestation bundles were made for plotnine_extra-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on mdmanurung/plotnine-extra
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
plotnine_extra-0.2.0-py3-none-any.whl -
Subject digest:
e6da040fadb3e4f81633502c8f042b99f5a798eac8159dd1fe93946e50ce15dd - Sigstore transparency entry: 1247294287
- Sigstore integration time:
-
Permalink:
mdmanurung/plotnine-extra@a3e6b248d2e198ead1057fbd251138be9ed1f4f5 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/mdmanurung
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a3e6b248d2e198ead1057fbd251138be9ed1f4f5 -
Trigger Event:
release
-
Statement type: