Skip to main content

ggplot for python

Project description

{ggplot}
========

::

from ggplot import *
from pandasql import load_meat
meat = load_meat()

ggplot(aes(x='date', y='beef'), data=meat) + \
geom_point() + \
geom_line(color='lightblue') + \
ggtitle("Beef: It's What's for Dinner") + \
xlab("Date") + \
ylab("Head of Cattle Slaughtered")

What is it?
~~~~~~~~~~~

Yes, it's another implementation of
```ggplot2`` <https://github.com/hadley/ggplot2>`__. One of the biggest
reasons why I continue to reach for ``R`` instead of ``Python`` for data
analysis is the lack of an easy to use, high level plotting package like
``ggplot``. I've tried other libraries like ``Bockah`` and ``d3py`` but
what I really want is ``ggplot2``.

``ggplot`` is just that. It's an extremely un-pythonic package for doing
exactly what ``ggplot2`` does. The goal of the package is to mimic the
``ggplot2`` API. This makes it super easy for people coming over from
``R`` to use, and prevents you from having to re-learn how to plot
stuff.

Goals
~~~~~

- same API as ``ggplot2`` for ``R``
- tight integration with
```pandas`` <https://github.com/pydata/pandas>`__
- pip installable

Getting Started
~~~~~~~~~~~~~~~

Dependencies
^^^^^^^^^^^^

- ``matplotlib``
- ``pandas``
- ``numpy``
- ``scipy``

unzip the matplotlibrc
======================

$ unzip matplotlibrc.zip ~/ $ pip install ggplot

Examples
~~~~~~~~

``geom_point``
^^^^^^^^^^^^^^

::

from ggplot import *
ggplot(diamonds, aes('carat', 'price')) + \
geom_point(alpha=1/20.)

``geom_hist``
^^^^^^^^^^^^^

::

p = ggplot(aes(x='carat'), data=diamonds)
p + geom_hist() + ggtitle("Histogram of Diamond Carats") + labs("Carats", "Freq")

``geom_bar``
^^^^^^^^^^^^

::

p = ggplot(mtcars, aes('cyl'))
p + geom_bar()

TODO
~~~~

- finish README
- add matplotlibrc to build script
- distribute on PyPi
- come up with better name
- handle NAs gracefully
- make ``aes`` guess what the user actually means (DONE)
- aes:

- size
- se for stat\_smooth
- fix fill/colour

- geoms:

- geom\_abline (DONE)
- geom\_area (DONE)
- geom\_bar (IN PROGRESS)
- geom\_boxplot
- geom\_hline (DONE)
- geom\_ribbon (same as geom\_ribbon?)
- geom\_vline (DONE)
- stat\_bin2d (DONE)
- geom\_jitter
- stat\_smooth (bug)

- scales:

- scale\_colour\_brewer
- scale\_colour\_gradient
- scale\_colour\_gradient2
- scale\_x\_continuous
- scale\_x\_discrete
- scale\_y\_continuous

- facets:

- facet\_grid (DONE)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ggplot-0.1.4.tar.gz (591.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ggplot-0.1.4-py2.7.egg (643.7 kB view details)

Uploaded Egg

File details

Details for the file ggplot-0.1.4.tar.gz.

File metadata

  • Download URL: ggplot-0.1.4.tar.gz
  • Upload date:
  • Size: 591.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ggplot-0.1.4.tar.gz
Algorithm Hash digest
SHA256 52e251e17a78710bcc5bc375a3d4e1492f79374a271198944e4de092c8675d19
MD5 3bb1c69504895d2102c9733e652e1c63
BLAKE2b-256 997f247e7f3cafc9515e631d015e0194a2567d470be5e140bbf9281c8465b7e9

See more details on using hashes here.

File details

Details for the file ggplot-0.1.4-py2.7.egg.

File metadata

  • Download URL: ggplot-0.1.4-py2.7.egg
  • Upload date:
  • Size: 643.7 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ggplot-0.1.4-py2.7.egg
Algorithm Hash digest
SHA256 d214bf2e2a185bc5c65f11c6fe47f4f9d068c5f9deefb44f7cf90e0db2c93057
MD5 a6b80b9c33c5cc47f9e646e3846148ad
BLAKE2b-256 514e7bdc854b04be2fddefb6d8d7704e9557ba13b087589f47a011092e8974a5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page