pyggplot是ggplot的python调用(非移植),ggplot是R中使用广泛的绘图库。
由于rpy2原项目托管在sourceforge已经无法访问,新的github镜像:https://github.com/randy3k/rpy2
pyggplot是 R ggplot2 库的封装。使用了rpy2进行调用,将Pandas数据帧对象传送到R中,然后使用rpy2进行调用。
示例
http://nbviewer.ipython.org/url/tyberiusprime.github.io/pyggplot/pyggplot%20samples.ipynb
安装
通过 PyPI
$ pip install pyggplot
You may be required to update pandas, rpy2, so you may be required to run
$ pip install --upgrade pyggplot
用法
import pandas as pd
import numpy as np
import ggplot
df = pd.DataFrame({'x': np.random.rand(100),
'y': np.random.randn(100),
'group': ['A','B'] * 50})
p = pyggplot.Plot(df)
p.add_scatter('x','y', color='group')
p.render('output.png')
## o