0

按照这个简单的例子,我正在尝试使用 yhat 的 ggplot python 模块制作一个简单的条形图。这是之前在 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>
4

1 回答 1

0

这适用于更新版本的 ggplot-python。它不是那么漂亮(x 轴标签),我们真的必须努力解决这个问题:-(

于 2014-08-17T15:40:10.250 回答