创建具有多个位置出现次数的直方图 [英] Creating a histogram with the number of occurrences at multiple places
本文介绍了创建具有多个位置出现次数的直方图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一组看起来像这样的数据(略大一些):
I have a set of data that looks like that (just way bigger):
2 7
3 9
5 3
2 4
7 3
3 4
2 2
我想生成一个直方图,其条形图的高度为2(7 + 4 + 2),所以13为13,高度为3,5为3,7为3.
and I would like to produce a histogram with bars at 2 of height (7+4+2), so 13, at 3 of height 13, 5 at 3 and 7 at 3.
我希望这个问题不要太愚蠢,但是我发现的教程没有讨论这个问题.感谢您的任何事先帮助.
I hope the question is not too dumb, but the tutorials I found did not discuss this problem. Thanks for any help in advance.
推荐答案
DF <- read.table(text="2 7
3 9
5 3
2 4
7 3
3 4
2 2")
library(ggplot2)
ggplot(DF,aes(x=V1,y=V2)) +stat_summary(fun.y=sum,geom="bar")
这篇关于创建具有多个位置出现次数的直方图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文