plotnine

A Grammar of Graphics for Python

https://github.com/has2k1/plotnine

Science Score: 64.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    7 of 112 committers (6.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.2%) to scientific vocabulary

Keywords

data-analysis grammar graphics plotting python

Keywords from Contributors

gtk qt tk wx closember timeseries-analysis robust-estimation regression-models prediction hypothesis-testing
Last synced: 6 months ago · JSON representation ·

Repository

A Grammar of Graphics for Python

Basic Info
  • Host: GitHub
  • Owner: has2k1
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage: https://plotnine.org
  • Size: 159 MB
Statistics
  • Stars: 4,334
  • Watchers: 62
  • Forks: 240
  • Open Issues: 75
  • Releases: 0
Topics
data-analysis grammar graphics plotting python
Created almost 9 years ago · Last pushed 6 months ago
Metadata Files
Readme License Code of conduct Citation

README.md

plotnine

Release License DOI Build Status Coverage

plotnine is an implementation of a grammar of graphics in Python based on ggplot2. The grammar allows you to compose plots by explicitly mapping variables in a dataframe to the visual characteristics (position, color, size etc.) of objects that make up the plot.

Plotting with a grammar of graphics is powerful. Custom (and otherwise complex) plots are easy to think about and build incrementally, while the simple plots remain simple to create.

To learn more about how to use plotnine, check out the documentation. Since plotnine has an API similar to ggplot2, where it lacks in coverage the ggplot2 documentation may be helpful.

Example

python from plotnine import * from plotnine.data import mtcars

Building a complex plot piece by piece.

  1. Scatter plot

python ( ggplot(mtcars, aes("wt", "mpg")) + geom_point() )

  1. Scatter plot colored according some variable

python ( ggplot(mtcars, aes("wt", "mpg", color="factor(gear)")) + geom_point() )

  1. Scatter plot colored according some variable and smoothed with a linear model with confidence intervals.

python ( ggplot(mtcars, aes("wt", "mpg", color="factor(gear)")) + geom_point() + stat_smooth(method="lm") )

  1. Scatter plot colored according some variable, smoothed with a linear model with confidence intervals and plotted on separate panels.

python ( ggplot(mtcars, aes("wt", "mpg", color="factor(gear)")) + geom_point() + stat_smooth(method="lm") + facet_wrap("gear") )

  1. Adjust the themes

I) Make it playful

python ( ggplot(mtcars, aes("wt", "mpg", color="factor(gear)")) + geom_point() + stat_smooth(method="lm") + facet_wrap("gear") + theme_xkcd() )

II) Or professional

python ( ggplot(mtcars, aes("wt", "mpg", color="factor(gear)")) + geom_point() + stat_smooth(method="lm") + facet_wrap("gear") + theme_tufte() )

Installation

Official release

```console

Using pip

$ pip install plotnine # 1. should be sufficient for most $ pip install 'plotnine[extra]' # 2. includes extra/optional packages $ pip install 'plotnine[test]' # 3. testing $ pip install 'plotnine[doc]' # 4. generating docs $ pip install 'plotnine[dev]' # 5. development (making releases) $ pip install 'plotnine[all]' # 6. everything

Or using conda

$ conda install -c conda-forge plotnine

Or using pixi

$ pixi init name-of-my-project $ cd name-of-my-project $ pixi add python plotnine ```

Development version

console $ pip install git+https://github.com/has2k1/plotnine.git

Contributing

Our documentation could use some examples, but we are looking for something a little bit special. We have two criteria:

  1. Simple looking plots that otherwise require a trick or two.
  2. Plots that are part of a data analytic narrative. That is, they provide some form of clarity showing off the geom, stat, ... at their differential best.

If you come up with something that meets those criteria, we would love to see it. See plotnine-examples.

If you discover a bug checkout the issues if it has not been reported, yet please file an issue.

And if you can fix a bug, your contribution is welcome.

Testing

Plotnine has tests that generate images which are compared to baseline images known to be correct. To generate images that are consistent across all systems you have to install matplotlib from source. You can do that with pip using the command.

console $ pip install matplotlib --no-binary matplotlib

Otherwise there may be small differences in the text rendering that throw off the image comparisons.

Owner

  • Name: Hassan Kibirige
  • Login: has2k1
  • Kind: user
  • Location: Kampala, Uganda

Citation (CITATION.bib)

@misc{plotnine,
  author = {The plotnine development team},
  title  = {plotnine: A grammar of graphics for Python},
  url    = {https://github.com/has2k1/plotnine},
  doi    = {https://doi.org/10.5281/zenodo.1325308}
}

GitHub Events

Total
  • Create event: 44
  • Release event: 7
  • Issues event: 120
  • Watch event: 308
  • Delete event: 36
  • Issue comment event: 129
  • Push event: 265
  • Pull request review event: 2
  • Pull request review comment event: 2
  • Pull request event: 20
  • Fork event: 25
Last Year
  • Create event: 44
  • Release event: 7
  • Issues event: 120
  • Watch event: 308
  • Delete event: 36
  • Issue comment event: 129
  • Push event: 265
  • Pull request review event: 2
  • Pull request review comment event: 2
  • Pull request event: 20
  • Fork event: 25

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 2,430
  • Total Committers: 112
  • Avg Commits per committer: 21.696
  • Development Distribution Score (DDS): 0.277
Past Year
  • Commits: 225
  • Committers: 9
  • Avg Commits per committer: 25.0
  • Development Distribution Score (DDS): 0.044
Top Committers
Name Email Commits
Hassan Kibirige h****1@g****m 1,756
Greg Lamp l****g@g****m 177
Jan Schulz j****c@g****t 87
Greg g****g@y****m 70
Greg g****g@y****m 43
George A. Dowding p****s@g****m 27
Florian Finkernagel f****l@i****e 22
Tyler Funnell t****l@g****m 20
Matthias Kümmerer m****s@m****g 20
Jonas Arnfred j****s@i****g 15
Austin Ogilvie a****e@g****m 15
Dan Blanchard d****d@e****g 12
stonebig s****g 11
Paul Natsuo Kishimoto m****l@p****e 8
Sergey Astanin s****n@g****m 7
ericchiang e****m@g****m 6
darthmall w****n@g****m 5
Michael Chow m****b@f****m 4
Bernard Willers b****s@g****m 4
cosinequanon s****r@d****m 4
Robert Gibboni r****g@b****u 4
Jessie Frazelle j****e 3
Simon Mutch s****h@u****u 3
Yaroslav Halchenko d****n@o****m 3
kalaidin p****n@g****m 3
Jeroen Janssens j****n@j****m 3
Josh Hartmann j****1@g****m 3
zachcp z****p@r****u 2
James Spencer j****r@g****m 2
Hugo van Kemenade h****k 2
and 82 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 279
  • Total pull requests: 76
  • Average time to close issues: 7 months
  • Average time to close pull requests: 5 months
  • Total issue authors: 178
  • Total pull request authors: 32
  • Average comments per issue: 2.0
  • Average comments per pull request: 1.36
  • Merged pull requests: 44
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 73
  • Pull requests: 18
  • Average time to close issues: 13 days
  • Average time to close pull requests: 7 days
  • Issue authors: 46
  • Pull request authors: 7
  • Average comments per issue: 0.85
  • Average comments per pull request: 0.56
  • Merged pull requests: 9
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • has2k1 (28)
  • machow (15)
  • AlFontal (6)
  • wangjiawen2013 (6)
  • jwhendy (5)
  • Hoeze (4)
  • ilia-kats (4)
  • nick-youngblut (4)
  • TerryGamon (4)
  • penguinpee (4)
  • wch (4)
  • jrr96 (3)
  • krassowski (3)
  • floringogianu (3)
  • kraxli (3)
Pull Request Authors
  • has2k1 (20)
  • krassowski (5)
  • machow (5)
  • TyberiusPrime (4)
  • AlFontal (2)
  • schackartk (2)
  • ccravens (2)
  • daylinmorgan (2)
  • Emerentius (2)
  • jwhendy (2)
  • bhvieira (2)
  • stettberger (2)
  • fkgruber (2)
  • kianmeng (2)
  • EvaMaeRey (2)
Top Labels
Issue Labels
bug (40) Question (26) Enhancement (22) enhancement (19) question (18) Feature (15) Documentation (15) feature (13) Installation (13) invalid (13) upstream-bug (10) Layout (9) Invalid (8) wontfix (6) meta (5) documentation (5) Reprex (5) Extensions (4) discussion (4) critical-bug (4) Discussion (3) Could Not Reproduce (2) Addressed in Next Version (2) Next Patch Release (1) Internal Dataframe (1) duplicate (1) Gold (1) Plot Composition (1) Help Wanted (1) Next Minor Release (1)
Pull Request Labels
Enhancement (2) Question (2) Feature (2) discussion (1)

Packages

  • Total packages: 16
  • Total downloads:
    • pypi 2,132,510 last-month
  • Total docker downloads: 3,578,343
  • Total dependent packages: 121
    (may contain duplicates)
  • Total dependent repositories: 1,386
    (may contain duplicates)
  • Total versions: 144
  • Total maintainers: 3
pypi.org: plotnine

A Grammar of Graphics for Python

  • Documentation: https://plotnine.readthedocs.io/
  • 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 "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • Latest release: 0.15.0
    published 7 months ago
  • Versions: 45
  • Dependent Packages: 116
  • Dependent Repositories: 1,276
  • Downloads: 2,132,510 Last month
  • Docker Downloads: 3,578,343
Rankings
Dependent packages count: 0.2%
Downloads: 0.2%
Dependent repos count: 0.3%
Average: 0.4%
Docker downloads count: 0.7%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.18: py3-plotnine

A grammar of graphics for Python

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 2.7%
Stargazers count: 4.0%
Forks count: 6.9%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.18: py3-plotnine-pyc

Precompiled Python bytecode for py3-plotnine

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 2.7%
Stargazers count: 4.0%
Forks count: 6.9%
Maintainers (1)
Last synced: 6 months ago
proxy.golang.org: github.com/has2k1/plotnine
  • Versions: 34
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.5%
Average: 5.7%
Dependent repos count: 5.9%
Last synced: 6 months ago
alpine-edge: py3-plotnine-pyc

Precompiled Python bytecode for py3-plotnine

  • Versions: 19
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Stargazers count: 4.0%
Average: 6.4%
Forks count: 8.2%
Dependent packages count: 13.4%
Maintainers (1)
Last synced: 6 months ago
alpine-edge: py3-plotnine

A grammar of graphics for Python

  • Versions: 20
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Stargazers count: 3.9%
Average: 6.6%
Forks count: 7.9%
Dependent packages count: 14.6%
Maintainers (1)
Last synced: 6 months ago
conda-forge.org: plotnine
  • Versions: 12
  • Dependent Packages: 5
  • Dependent Repositories: 55
Rankings
Dependent repos count: 4.8%
Stargazers count: 6.9%
Average: 8.7%
Dependent packages count: 10.4%
Forks count: 12.8%
Last synced: 6 months ago
anaconda.org: plotnine

plotnine is an implementation of a grammar of graphics in Python based on ggplot2. The grammar allows you to compose plots by explicitly mapping variables in a dataframe to the visual objects that make up the plot.

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 55
Rankings
Stargazers count: 14.0%
Forks count: 22.7%
Dependent repos count: 23.6%
Average: 27.9%
Dependent packages count: 51.2%
Last synced: 6 months ago
alpine-v3.21: py3-plotnine-pyc

Precompiled Python bytecode for py3-plotnine

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.19: py3-plotnine-pyc

Precompiled Python bytecode for py3-plotnine

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.22: py3-plotnine

A grammar of graphics for Python

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.21: py3-plotnine

A grammar of graphics for Python

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.22: py3-plotnine-pyc

Precompiled Python bytecode for py3-plotnine

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.19: py3-plotnine

A grammar of graphics for Python

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Last synced: 6 months ago
alpine-v3.20: py3-plotnine

A grammar of graphics for Python

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 6 months ago
alpine-v3.20: py3-plotnine-pyc

Precompiled Python bytecode for py3-plotnine

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 6 months ago

Dependencies

requirements/dev.txt pypi
  • adjustText *
  • flake8 *
  • geopandas *
  • jupyter *
  • nbsphinx *
  • notebook *
  • numpydoc >=0.9.1
  • plotnine_examples *
  • pytest-cov *
  • scikit-learn *
  • scikit-misc *
  • sphinx >=3.0.0
  • twine *
  • wheel *
requirements/doc.txt pypi
  • plotnine_examples *
requirements/rtd.txt pypi
  • adjustText *
  • importlib_resources *
  • jupyter *
  • matplotlib *
  • mizani *
  • nbsphinx *
  • numpydoc >=0.9.1
  • pandas *
  • plotnine_examples *
  • scipy *
  • sphinx >=3.0.0
  • statsmodels *