创建数据框以存储点坐标的快速解决方案:
set.seed(555)
x = rnorm(1e3)
h = hist( x = x, axes = F, labels = T )
point_df = data.frame(
x = unlist(sapply(1:length(h$mids), function(i) rep(h$mids[i], each = h$counts[i]))),
y = unlist(sapply(h$counts, function(c) 1:c))
)
points(point_df$x, point_df$y)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句