抖动到多个点,我可以吗?

时间:2015-03-18 14:00:00

标签: r ggplot2

我可以将geom_jitter这些频率作为多个点吗?

head(GOL_F_WriteCounter, 10)

Var1          Freq
1  2014-10-20   44
2  2014-10-21   64
3  2014-10-22   43
4  2014-10-23   32
5  2014-10-24   24
6  2014-10-25   18
7  2014-10-26   26
8  2014-10-27   31
9  2014-10-28   45
10 2014-10-29   30

我的代码:

ggplot(GOL_F_WriteCounter, aes(x= Var1, y= Freq))+
   geom_jitter()+ scale_x_date()`

enter image description here

1 个答案:

答案 0 :(得分:2)

这样的事情怎么样?

d <- GOL_F_WriteCounter[
    unlist(Map(rep, 1:nrow(GOL_F_WriteCounter), GOL_F_WriteCounter$Freq)), ]
d$y <- unlist(lapply(GOL_F_WriteCounter$Freq, seq))
ggplot(d, aes(x = Var1, y = y)) + geom_jitter() + scale_x_date()

enter image description here