plotnine
A Grammar of Graphics for Python
Decision gist · record as of 2026-08-14
Yes. plotnine is actively maintained, has no known vulnerabilities, installs with low friction, and offers a genuinely different (and for many users, more intuitive) approach to plotting than matplotlib's imperative style. It's well-suited for exploratory analysis and publication graphics if you prefer declarative composition. The MIT license is unrestricted. Install it if you work with pandas DataFrames and want to think about plots as layered grammars rather than imperative drawing commands.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction install with a pure-Python wheel.
- Active maintenance (last commit 2026-08-14) and a stable dependency set on matplotlib, pandas, numpy, scipy, statsmodels, and mizani.
- Supports Python 3.10 through 3.13.
License · maintenance · safety
permissive license (permissive) — MIT license (permissive). You can use, modify, and distribute plotnine freely in commercial and private projects with minimal restrictions, provided you include the license notice.
last release 2026-08-14 (0 days) · last repo commit 2026-08-14 · 4,760 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 3,416,684 downloads/mo, #2,629 on PyPI
Alternatives
Verify before relying
pip install plotnine
from plotnine import ggplot, aes, geom_point
from plotnine.data import mtcars
(ggplot(mtcars, aes('wt', 'mpg'))
+ geom_point())- Whether image-based testing (comparing generated plots to baselines) is required for contributions or only for development.
- Performance characteristics with large datasets or complex multi-layer plots.
- Extent of API coverage compared to ggplot2 and which features may still be missing.
What it is and what it does
plotnine is a Python implementation of the grammar of graphics, modeled on R's ggplot2. It lets you build plots declaratively by mapping variables from a pandas DataFrame to visual properties (axes, colors, sizes, shapes) and then layering geometric objects, statistics, and themes using the `+` operator. Each layer is added incrementally, making it easy to build complex visualizations step by step while keeping simple plots simple.
The package depends on matplotlib for rendering, pandas for data handling, and scipy and statsmodels for statistical transformations. It works across macOS, Windows, and Unix, and supports current Python versions (3.10–3.13). The API mirrors ggplot2 closely, so R users can transfer their plotting intuition directly, and the documentation points to ggplot2 references where plotnine's coverage is incomplete.
Use it for
- Build exploratory scatter plots with color-coded groups and trend lines, composing layers incrementally without rewriting the whole plot.
- Create publication-ready multi-panel plots using faceting to compare distributions or relationships across categorical subsets of data.
- Apply consistent themes and styling to a suite of plots by defining a theme once and reusing it across multiple visualizations.
- Perform statistical visualization (smoothing, confidence intervals, density estimation) by combining geoms with stats like stat_smooth.
- Prototype complex plots interactively in notebooks, adding and removing layers to refine the visualization without switching tools.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
plotnine is actively maintained, has no known vulnerabilities, installs with low friction, and offers a genuinely different (and for many users, more intuitive) approach to plotting than matplotlib's imperative style. It's well-suited for exploratory analysis and publication graphics if you prefer declarative composition. The MIT license is unrestricted. Install it if you work with pandas DataFrames and want to think about plots as layered grammars rather than imperative drawing commands.
Install
plotnine on PyPI
Before you install
Low friction install with a pure-Python wheel. Active maintenance (last commit 2026-08-14) and a stable dependency set on matplotlib, pandas, numpy, scipy, statsmodels, and mizani. Supports Python 3.10 through 3.13.
License in practice
MIT license (permissive). You can use, modify, and distribute plotnine freely in commercial and private projects with minimal restrictions, provided you include the license notice.
Quickstart
pip install plotnine
from plotnine import ggplot, aes, geom_point
from plotnine.data import mtcars
(ggplot(mtcars, aes('wt', 'mpg'))
+ geom_point())
Verify before relying
- Whether image-based testing (comparing generated plots to baselines) is required for contributions or only for development.
- Performance characteristics with large datasets or complex multi-layer plots.
- Extent of API coverage compared to ggplot2 and which features may still be missing.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 6 packagesmatplotlibpandasmizaninumpyscipystatsmodels |
| Maintenance | Actively maintained 0 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,416,684 / month, #2,629 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Framework :: MatplotlibIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: UnixProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Topic :: Scientific/Engineering :: Visualization |
Evidence: plotnine-0.15.8-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “grammar of graphics python”
- plotnineplotnine implements a grammar of graphics for Python, letting you…
- ggplotggplot is a Python implementation of the grammar of graphics that…
- bqscalesbqscales implements a grammar-of-graphics layer for creating…
Give your agent the search over MCP, or paste the wish link into any chat.
More Visualization packages
matplotlib creates static, animated, and interactive visualizations in Python, producing publication-quality figures in multiple formats for scripts, shells, web servers, and graphical interfaces.
Install it if you need to visualize data, generate publication-quality figures, or embed plots in applications.
ContourPy calculates contours of 2D quadrilateral grids using C++11 algorithms wrapped in Python, offering serial and multithreaded implementations without requiring Matplotlib as a dependency.
Plotly is an interactive, browser-based graphing library that creates charts and visualizations from Python, rendering them as HTML that can be viewed in Jupyter notebooks, standalone files, or web applications.
Generates DOT language source code for graph structures and renders them using the Graphviz graph drawing software installed on your system.
Install it if you need to generate or render graphs from Python.
Streamlit transforms Python scripts into interactive web applications with minimal code, enabling rapid development of data dashboards, reports, and chat interfaces without requiring web development expertise.
Leather is a lightweight Python charting library for quick, no-frills data visualization. It generates charts without requiring perfect styling or extensive configuration.
See also ggplot · mizani · plotille · plotext · bqscales · textual-plotext · UpSetPlot · bqplot · adjustText · altair