ggplot2:sample()的奇怪行为

时间:2013-04-29 20:11:53

标签: r ggplot2

今天在ggplot2中使用sample()时遇到了一个有趣的问题。有人能指出我的解决方案吗?

library(ggplot2)

dat <- data.frame("xvar"=runif(500, 1, 10), 
                  "yvar"=runif(500, 1, 10))

#works
ggplot(data=dat, aes(x=sample(xvar, 50), y=sample(yvar, 50)))+
  geom_point()

#doesn't work
ggplot(data=dat, aes(x=sample(xvar, 60), y=sample(yvar, 60)))+
  geom_point()

0 个答案:

没有答案
相关问题