Skip to main content
pyggplot is a pythonic wrapper around the R ggplot2 library ( http://had.co.nz/ggplot2/ ).

Unlike the python ggplot (https://github.com/yhat/ggplot) this is not a reimplementation
based on matplotlib, but a straight forward 'take pandas DataFrames and shove them into R via rpy2'
approach.

Usage:
df = pandas.DataFrame({'x': numpy.uniform(size=100), 'y' = numpy.uniform(size=100), 'group' = ['A','B'] * 50})
p = pyggplot.Plot(df)
p.add_scatter('x','y', color='group')
p.render('output.png')

Takes a pandas.DataFrame object, then add layers with the various add_xyz
functions (e.g. add_scatter).

Refer to the ggplot documentation about the layers (geoms), and simply
replace geom_* with add_*.
See http://docs.ggplot2.org/0.9.3.1/index.html

You do not need to separate aesthetics from values - the wrapper
will treat a parameter as value if and only if it is not a column name.
(so y = 0 is a value, color = 'blue 'is a value - except if you have a column
'blue', then it's a column!. And y = 'value' doesn't work, but that seems to be a ggplot issue).

When the DataFrame is passed to R:
- row indices are turned into columns with 'reset_index'
- multi level column indices are flattened by concatenating them with ' '
-> (X, 'mean) becomes 'x mean'

Error messages are not great - most of them translate to 'one or more columns were not found',
but they can appear as a lot of different actual messages such as
- argument "env" is missing, with no default
- object 'y' not found
- object 'dat_0' not found
- requires the following missing aesthetics: x
- non numeric argument to binary operator
without actually quite pointing at what is strictly the offending value.
Also, the error appears when rendering (or printing in Ipython notebook),
not when adding the layer.

Open questions:
- the stat support is not great - it doesn't easily map into pythonic objects. For now, do your stats in pandas - more powerful anyhow!
- how could error messages be improved?

Release files for pyggplot 5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyggplot 5
File Size Uploaded
pyggplot-5.tar.gz 18.5 kB Details

Release files / pyggplot-5.tar.gz

Download URL pyggplot-5.tar.gz
Size 18.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c3cd8a881ba239147f597a42647953feddbd68d12c4067d2a79f2b879c050808
BLAKE2b-256 checksum
How to use checksums
75d196689105dcdbae84b13e82576bc0cf29a0a211d68f69bdedc4903e8323cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

27

1 release file

26

1 release file

25

1 release file

24

1 release file

23

1 release file

22

1 release file

21

1 release file

20

1 release file

19

1 release file

17

1 release file

16

1 release file

15

1 release file

13

1 release file

12

1 release file

11

1 release file

10

1 release file

8

1 release file

7

1 release file

6

1 release file

This release

5 This release

1 release file

3

1 release file

2

1 release file

1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page