ProductPromotion
Logo

Python.py

made by https://0x3d.site

Things
we have.

GitHub - has2k1/plotnine: A Grammar of Graphics for Python
A Grammar of Graphics for Python. Contribute to has2k1/plotnine development by creating an account on GitHub.
Visit Site

GitHub - has2k1/plotnine: A Grammar of Graphics for Python

GitHub - has2k1/plotnine: A Grammar of Graphics for Python

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

from plotnine import *
from plotnine.data import mtcars

Building a complex plot piece by piece.

  1. Scatter plot

    (
        ggplot(mtcars, aes("wt", "mpg"))
        + geom_point()
    )
    
  2. Scatter plot colored according some variable

    (
        ggplot(mtcars, aes("wt", "mpg", color="factor(gear)"))
        + geom_point()
    )
    
  3. Scatter plot colored according some variable and smoothed with a linear model with confidence intervals.

    (
        ggplot(mtcars, aes("wt", "mpg", color="factor(gear)"))
        + geom_point()
        + stat_smooth(method="lm")
    )
    
  4. Scatter plot colored according some variable, smoothed with a linear model with confidence intervals and plotted on separate panels.

    (
        ggplot(mtcars, aes("wt", "mpg", color="factor(gear)"))
        + geom_point()
        + stat_smooth(method="lm")
        + facet_wrap("gear")
    )
    
  5. Adjust the themes

    I) Make it playful

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

    II) Or professional

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

Installation

Official release

# 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

Development version

$ 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.

$ pip install matplotlib --no-binary matplotlib

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

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Python.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory