Git Product home page Git Product logo

ggpylot's Introduction

ggpylot

ggplot2 interface in Python via rpy2

Requirements

  • You need to have R installed and the ggplot2 package installed inside R.
  • pandas
  • rpy2 >= 2.4.0 (tested on 2.4.4)

Example

from ggpylot import *
p = ggplot(mtcars, aes(x='mpg', y='qsec', colour='factor(cyl)')) + geom_point()
p.plot()

Example plot

To close the plot window, you must do this:

dev_off()

Or else bad things will happen! (I'm working on fixing this.)

You can see a variety of other examples in the file tests.py.

Features

  1. Lets you use R's ggplot2 package from Python without explicitly dealing with R. All ggplot2 functionality should be available.
  2. The Python interface is very similar to the underlying R interface and to the interface in the yhat ggplot project.
  3. It works in IPython notebooks.

Previous projects along these lines

I will be building on these things.

  1. rpy2's interface to ggplot2

The rpy2 interface to ggplot2 attempts to align the universe of R ggplot objects with Python objects connected to underlying R objects. This is a good idea but it is hard to keep it up to date as the underlying R package changes. For instance, the interface of rpy2's ggplot2 is already out of date.

  1. Yhat's ggplot module

This is an attempt to recreate ggplot on the basis of matplotlib. This is an admirable project: it is probably the way to go in the long run. But right now the python ggplot lacks some of the functionality of R's ggplot2, and I find the defaults in the python ggplot to not be as good as the defaults in R. I do think that is the way of the future though, so I'm going to try to make the interface here compatible with the yhat ggplot package.

The Approach Here

All we need is a thin layer over R's ggplot2 library as imported with rpy2's importr function, and some ad-hoc fixes for weird stuff that arises. We also need some customized object conversion. Shouldn't be hard, right?

Installation

python setup.py build
python setup.py install

ggpylot's People

Contributors

futrell avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.