{"id":13465644,"url":"https://github.com/has2k1/plotnine","last_synced_at":"2026-01-29T14:13:27.064Z","repository":{"id":37359270,"uuid":"89276692","full_name":"has2k1/plotnine","owner":"has2k1","description":"A Grammar of Graphics for Python","archived":false,"fork":false,"pushed_at":"2025-05-13T16:28:35.000Z","size":161963,"stargazers_count":4206,"open_issues_count":74,"forks_count":233,"subscribers_count":62,"default_branch":"main","last_synced_at":"2025-05-13T16:40:50.854Z","etag":null,"topics":["data-analysis","grammar","graphics","plotting","python"],"latest_commit_sha":null,"homepage":"https://plotnine.org","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/has2k1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"code-of-conduct.md","threat_model":null,"audit":null,"citation":"CITATION.bib","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-04-24T19:00:44.000Z","updated_at":"2025-05-13T15:59:28.000Z","dependencies_parsed_at":"2022-07-12T05:30:32.767Z","dependency_job_id":"c86a868b-fe2e-4134-9c79-ba4ddbc996a0","html_url":"https://github.com/has2k1/plotnine","commit_stats":{"total_commits":1798,"total_committers":106,"mean_commits":"16.962264150943398","dds":"0.36262513904338156","last_synced_commit":"b855157ee5834e6b96e591407869b5d5859b4b0e"},"previous_names":[],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/has2k1%2Fplotnine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/has2k1%2Fplotnine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/has2k1%2Fplotnine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/has2k1%2Fplotnine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/has2k1","download_url":"https://codeload.github.com/has2k1/plotnine/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253990449,"owners_count":21995773,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-analysis","grammar","graphics","plotting","python"],"created_at":"2024-07-31T15:00:33.199Z","updated_at":"2026-01-29T14:13:27.054Z","avatar_url":"https://github.com/has2k1.png","language":"Python","readme":"# plotnine \u003cimg width=\"20%\" align=\"right\" src=\"https://github.com/has2k1/plotnine/blob/logos/doc/images/logo-512.png?raw=true\"\u003e\n\n[![Release](https://img.shields.io/pypi/v/plotnine.svg)](https://pypi.python.org/pypi/plotnine)\n[![License](https://img.shields.io/pypi/l/plotnine.svg)](https://pypi.python.org/pypi/plotnine)\n[![DOI](https://zenodo.org/badge/89276692.svg)](https://zenodo.org/badge/latestdoi/89276692)\n[![Build Status](https://github.com/has2k1/plotnine/workflows/build/badge.svg?branch=main)](https://github.com/has2k1/plotnine/actions?query=branch%3Amain+workflow%3A%22build%22)\n[![Coverage](https://codecov.io/github/has2k1/plotnine/coverage.svg?branch=main)](https://codecov.io/github/has2k1/plotnine?branch=main)\n\nplotnine is an implementation of a *grammar of graphics* in Python\nbased on [ggplot2](https://github.com/tidyverse/ggplot2).\nThe grammar allows you to compose plots by explicitly mapping variables in a\ndataframe to the visual characteristics (position, color, size etc.) of objects that make up the plot.\n\nPlotting with a *grammar of graphics* is powerful. Custom (and otherwise\ncomplex) plots are easy to think about and build incrementally, while the\nsimple plots remain simple to create.\n\nTo learn more about how to use plotnine, check out the\n[documentation](https://plotnine.org). Since plotnine\nhas an API similar to ggplot2, where it lacks in coverage the\n[ggplot2 documentation](http://ggplot2.tidyverse.org/reference/index.html)\nmay be helpful.\n\n\n## Example\n\n```python\nfrom plotnine import *\nfrom plotnine.data import mtcars\n```\n\nBuilding a complex plot piece by piece.\n\n1. Scatter plot\n\n   ```python\n   (\n       ggplot(mtcars, aes(\"wt\", \"mpg\"))\n       + geom_point()\n   )\n   ```\n\n   \u003cimg width=\"90%\" align=\"center\" src=\"https://github.com/has2k1/plotnine/blob/logos/doc/images/readme-image-1.png?raw=true\"\u003e\n\n2. Scatter plot colored according some variable\n\n   ```python\n   (\n       ggplot(mtcars, aes(\"wt\", \"mpg\", color=\"factor(gear)\"))\n       + geom_point()\n   )\n   ```\n\n   \u003cimg width=\"90%\" align=\"center\" src=\"https://github.com/has2k1/plotnine/blob/logos/doc/images/readme-image-2.png?raw=true\"\u003e\n\n3. Scatter plot colored according some variable and\n   smoothed with a linear model with confidence intervals.\n\n   ```python\n   (\n       ggplot(mtcars, aes(\"wt\", \"mpg\", color=\"factor(gear)\"))\n       + geom_point()\n       + stat_smooth(method=\"lm\")\n   )\n   ```\n\n   \u003cimg width=\"90%\" align=\"center\" src=\"https://github.com/has2k1/plotnine/blob/logos/doc/images/readme-image-3.png?raw=true\"\u003e\n\n4. Scatter plot colored according some variable,\n   smoothed with a linear model with confidence intervals and\n   plotted on separate panels.\n\n   ```python\n   (\n       ggplot(mtcars, aes(\"wt\", \"mpg\", color=\"factor(gear)\"))\n       + geom_point()\n       + stat_smooth(method=\"lm\")\n       + facet_wrap(\"gear\")\n   )\n   ```\n\n   \u003cimg width=\"90%\" align=\"center\" src=\"https://github.com/has2k1/plotnine/blob/logos/doc/images/readme-image-4.png?raw=true\"\u003e\n\n5. Adjust the themes\n\n\n   I) Make it playful\n\n   ```python\n   (\n       ggplot(mtcars, aes(\"wt\", \"mpg\", color=\"factor(gear)\"))\n       + geom_point()\n       + stat_smooth(method=\"lm\")\n       + facet_wrap(\"gear\")\n       + theme_xkcd()\n   )\n   ```\n\n   \u003cimg width=\"90%\" align=\"center\" src=\"https://github.com/has2k1/plotnine/blob/logos/doc/images/readme-image-5.png?raw=true\"\u003e\n\n   II) Or professional\n\n   ```python\n   (\n       ggplot(mtcars, aes(\"wt\", \"mpg\", color=\"factor(gear)\"))\n       + geom_point()\n       + stat_smooth(method=\"lm\")\n       + facet_wrap(\"gear\")\n       + theme_tufte()\n   )\n   ```\n\n   \u003cimg width=\"90%\" align=\"center\" src=\"https://github.com/has2k1/plotnine/blob/logos/doc/images/readme-image-5alt.png?raw=true\"\u003e\n\n## Installation\n\nOfficial release\n\n```console\n# Using pip\n$ pip install plotnine             # 1. should be sufficient for most\n$ pip install 'plotnine[extra]'    # 2. includes extra/optional packages\n$ pip install 'plotnine[test]'     # 3. testing\n$ pip install 'plotnine[doc]'      # 4. generating docs\n$ pip install 'plotnine[dev]'      # 5. development (making releases)\n$ pip install 'plotnine[all]'      # 6. everything\n\n# Or using conda\n$ conda install -c conda-forge plotnine\n\n# Or using pixi\n$ pixi init name-of-my-project\n$ cd name-of-my-project\n$ pixi add python plotnine\n```\n\nDevelopment version\n\n```console\n$ pip install git+https://github.com/has2k1/plotnine.git\n```\n\n## Contributing\n\nOur documentation could use some examples, but we are looking for something\na little bit special. We have two criteria:\n\n1. Simple looking plots that otherwise require a trick or two.\n2. Plots that are part of a data analytic narrative. That is, they provide\n   some form of clarity showing off the `geom`, `stat`, ... at their\n   differential best.\n\nIf you come up with something that meets those criteria, we would love to\nsee it. See [plotnine-examples](https://github.com/has2k1/plotnine-examples).\n\nIf you discover a bug checkout the [issues](https://github.com/has2k1/plotnine/issues)\nif it has not been reported, yet please file an issue.\n\nAnd if you can fix a bug, your contribution is welcome.\n\nTesting\n-------\n\nPlotnine has tests that generate images which are compared to baseline images known\nto be correct. To generate images that are consistent across all systems you have\nto install matplotlib from source. You can do that with ``pip`` using the command.\n\n```console\n$ pip install matplotlib --no-binary matplotlib\n```\n\nOtherwise there may be small differences in the text rendering that throw off the\nimage comparisons.\n","funding_links":[],"categories":["资源列表","Python","Visualization","Figures","Data Visualization","数据可视化","其他_机器学习与深度学习","Data Visualization [🔝](#readme)","Miscellaneous","Uncategorized","Other InfoVis"],"sub_categories":["数据可视化","Packages","Python packages","Data Management","Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhas2k1%2Fplotnine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhas2k1%2Fplotnine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhas2k1%2Fplotnine/lists"}