[英]creating a time series plot in R, binning instances in each day, and plotting point size by number of instances in the bin
[英]R histogram number of instances in each bin on plot
我也希望看到每個bin的實例數量也顯示在圖表上
set.seed(1)
x<-rnorm(1:100)
hist(x)
嘗試這個
set.seed(1)
x<-rnorm(1:100)
y <- hist(x, plot=FALSE)
plot(y, ylim=c(0, max(y$counts)+5))
text(y$mids, y$counts+3, y$counts, cex=0.75)
這使:
另一個簡單得多的解決方案是在hist(...)方法本身中使用labels = TRUE 。 它將在直方圖中的每個bin的頂部包括出現次數/計數。
但是,我建議在直方圖中始終包含xlim和ylim 。
碼:
set.seed(1)
x <- rnorm(1:100)
hist(x, xlim = c(-3,3), ylim = c(1,30), labels = TRUE)
那會自動發生。 左邊叫做“頻率”
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.