【发布时间】:2011-07-10 05:04:09
【问题描述】:
对于以下数据集,
Genre Amount
Comedy 10
Drama 30
Comedy 20
Action 20
Comedy 20
Drama 20
我想构建一个 ggplot2 折线图,其中 x 轴是 Genre,y 轴是所有金额的总和(以 Genre 为条件)。
我尝试了以下方法:
p = ggplot(test, aes(factor(Genre), Gross)) + geom_point()
p = ggplot(test, aes(factor(Genre), Gross)) + geom_line()
p = ggplot(test, aes(factor(Genre), sum(Gross))) + geom_line()
但无济于事。
【问题讨论】:
标签: r ggplot2 summarization