[英]How to fill up each column of a Frequency histogram with points in R?
快速解決方案,創建一個數據框來存儲點坐標:
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)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.