【发布时间】:2014-08-17 23:40:10
【问题描述】:
在this simple example 之后,我正在尝试使用 yhat 的 ggplot python 模块制作一个简单的条形图。这是code suggested previously on StackOverflow:
In [1]:
from ggplot import *
import pandas as pd
df = pd.DataFrame({"x":[1,2,3,4], "y":[1,3,4,2]})
ggplot(aes(x="x", weight="y"), df) + geom_bar()
但我得到一个错误:
Out[1]:
<repr(<ggplot.ggplot.ggplot at 0x104b18ad0>) failed: UnboundLocalError: local variable 'ax' referenced before assignment>
【问题讨论】:
-
关于 python-ggplot 的事情是它还处于开发的早期阶段。您可以尝试升级到最新版本,它似乎确实会输出类似于条形图的内容,但似乎仍然不太正确。
标签: python python-ggplot