如何在ggplot堆叠栏中为y轴提供表的总行数?

问题描述 投票:0回答:1

我正在使用GGPLOT创建堆积的条形图,其中y轴应该是电影的总数,x轴应该是年份,填充应该是国家。

[到目前为止,我已经尝试过,但是Y轴给出了不规则数字:

ggplot(IMDB, aes(fill=country,y=nrow(IMDB), x=year)) 
 + geom_bar(position="stack", stat="identity")
r ggplot2 bar-chart stacked-chart
1个回答
0
投票

也许尝试:

ggplot(IMDB, aes(fill=country, x=year)) 
 + geom_bar(position="stack")

geom_bar将给出每个类别每年的电影计数。

这是您要寻找的吗?

© www.soinside.com 2019 - 2024. All rights reserved.