0

来自 python 中 ggplot 的 Geombar。

这是这个 geombar 的代码

gg1 = ggplot(aes(y='y', x='x'), data=new_data) +
    geom_bar(stat="identity") +   
    labs(x="Hour of day",y="Hourly entries") +
    ggtitle("Riders per a hour of day for weekdays")

new_data 是我从一个更大的数据库中取出的两列。数据很大。x 变量我们在 4 小时块中的小时数(0、4、8、12 等)和 y 变量是这些块中的条目数量。

如果我这样做。

gg1 = ggplot(aes(y='y', x='x', fill = 'r'), data=new_data) +
    geom_bar(stat="identity") + 
    labs(x="Hour of day",y="Hourly entries") +
    ggtitle("Riders per a hour of day for weekdays")

我通常得到

ValueError: incompatible sizes: argument 'bottom' must be length 22570 or scalar

现在我得到与上面相同的图表。

4

0 回答 0