1

图片说明了这个问题——你能去掉 x 轴上这些额外的 'foo' 和 'bar' 刻度吗?

有问题的 x 轴

4

1 回答 1

0

我在这里找到了答案:http: //www.cookbook-r.com/Graphs/Bar_and_line_graphs_ (ggplot2)/

最重要的是,工作代码指定 stat='identity'。

df = pandas.DataFrame({"x" : ["foo", "bar"], "y": [2000,1500]})
plot = ggplot(aes(x="x",y="y"), data=df) +\ # y NOT weight
         geom_bar(stat='identity') +\ # stat='bin' by default
print plot
于 2015-08-03T07:18:21.657 回答