--- id: plotnine version: "0.15.8" license: The MIT License (MIT) Copyright (c) 2022 Hassan Kibirige Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the… (full text in the JSON record) license_treatment: permissive maintenance: active --- # plotnine — A Grammar of Graphics for Python License: permissive · Maintenance: active · Downloads: 3.4M/mo ## 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 above — verify before relying. plotnine implements a grammar of graphics for Python, letting you build plots by explicitly mapping dataframe variables to visual properties like position, color, and size, then composing them with operators. 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 pip install plotnine uv add plotnine poetry add plotnine ## Installing plotnine 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: The MIT License (MIT) Copyright (c) 2022 Hassan Kibirige Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the… (full text in the JSON record) (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 3.4M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags grammar of graphics python, ggplot2 python equivalent, declarative plotting dataframe, layered plot composition, statistical graphics python, data visualization grammar, matplotlib alternative plotting, data-visualization, grammar-of-graphics, ggplot2-inspired [View on SkillFed](https://skillfed.io/packages/plotnine) · [View on PyPI](https://pypi.org/project/plotnine/)