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)
Metadata
Release files for plotnine-extra 0.2.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 |
|---|---|---|---|---|
| plotnine_extra-0.2.0.tar.gz | 97.4 kB | With provenance | Details for plotnine_extra-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| plotnine_extra-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for plotnine_extra-0.2.0-py3-none-any.whl |
Total release size: 211.6 kB
Release files / plotnine_extra-0.2.0.tar.gz
| Download URL | plotnine_extra-0.2.0.tar.gz |
|---|---|
| Size | 97.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a72725dda5d60b4de9eef88e8032c8b8c0631c42bca7ba5b2990574c2c3b2917
|
|
BLAKE2b-256 checksum How to use checksums |
56e055c3037a54934d3bd59877d0e576c91bb6031984910eec3909385dcac001
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 7, 2026.
Transparency logRelease files / plotnine_extra-0.2.0-py3-none-any.whl
| Download URL | plotnine_extra-0.2.0-py3-none-any.whl |
|---|---|
| Size | 114.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e6da040fadb3e4f81633502c8f042b99f5a798eac8159dd1fe93946e50ce15dd
|
|
BLAKE2b-256 checksum How to use checksums |
57ac846842984e2b2c8ef6bef46ad96b6f8caf32844ed0fb05d7f7c4bdf37211
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 7, 2026.
Transparency logSecurity for plotnine-extra 0.2.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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for plotnine_extra-0.2.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 Apr 7, 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.