[英]Coloring Stripcharts in R
也許最簡單的事情是編寫一個簡單的腳本來進行數學運算,並使用標准plot()函數繪制帶狀圖
#generate some random numeric data
set.seed(100)
d <- sample(10:80, size = 150, replace = TRUE)
# count re-occurences of the same value (for plotting on the y-axis)
td <- do.call(rbind, lapply(1:length(d), (function(i){
c(d[i], 1+ sum(d[1:i] == d[i]))})))
# plot
plot(x= td[,1], y = td[,2],
pch=19, ylim = c(0, 20),
col = ifelse(td[,1]>49, "red", "blue"))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.