plotnine – Implementation of a Grammar of Graphics in Python

plotnine is an implementation of a grammar of graphics in Python. It’s based on ggplot2.

A grammar of graphics is a tool that enables us to concisely describe the components of a graphic. It allows us to move beyond named graphics (e.g., the ‘scatterplot’) and gain insight into the deep structure that underlies statistical graphics. Plotting with a grammar is powerful, it makes custom (and otherwise complex) plots easy to think about and then create, while simple plots remain simple.

The grammar allows users to compose plots by explicitly mapping data to the visual objects that make up the plot.

Features include:

  • Similar API to ggplot2.
  • Good for custom plots.

plotnine draws upon a number of other open source projects:

  • Six – a Python 2 and 3 compatibility library. It provides utility functions for smoothing over the differences between the Python versions with the goal of writing Python code that is compatible on both Python versions.
  • matplotlib – for interactive graphing, scientific publishing, user interface development, and web application servers targeting multiple user interfaces and hardcopy output formats.
  • NumPy – a general-purpose array-processing package designed to efficiently manipulate large multi-dimensional arrays of arbitrary records without sacrificing too much speed for small multi-dimensional arrays.
  • SciPy – a scientific Python library for mathematics, science, and engineering.
  • Patsy – a Python library for describing statistical models (especially linear models, or models that have a linear component) and building design matrices.
  • Mizani – a scales package for graphics. It’s based on Hadley Wickham’s Scales package.
  • Statsmodels – a Python package that provides a complement to SciPy for statistical computations including descriptive statistics and estimation and inference for statistical models.
  • pandas – a Python package providing fast, flexible, and expressive data structures designed to make working with structured (tabular, multidimensional, potentially heterogeneous) and time series data both easy and intuitive.
  • pytz – a library that enables accurate and cross platform timezone calculations using Python 2.4 or higher.
  • dateutil – provides extensions to the standard Python datetime module.
  • PyParsing – a Python parsing module that offers an alternative approach to creating and executing simple grammars, vs. the traditional lex/yacc approach, or the use of regular expressions.
  • Palettable – a library of color palettes for Python.
  • Cycler – composable cycles.
  • subprocess32 – a backport of the subprocess standard library module from Python 3.2 & 3.3 for use on Python 2.
  • kiwisolver – a fast implementation of the Cassowary constraint solver.

Website: github.com/has2k1/plotnine
Support: Documentation
Developer: Hassan Kibirige
License: GNU GPL v2.0

plotnine

plotnine is written in Python. Learn Python with our recommended free books and free tutorials.

Return to Python Visualization Packages Home Page

Read our complete collection of recommended free and open source software. The collection covers all categories of software.
Share this article

Share your Thoughts

This site uses Akismet to reduce spam. Learn how your comment data is processed.