-2
Q
分組圖表,錯誤條
A
回答
1
假設您正在使用的手段和標準偏差爲你的錯誤吧,你可以這樣做這方面的工作(我創造,我認爲可能看起來像你這樣的數據幀):
library(tidyverse)
df <- data.frame(num = runif(160, min = 0, max = 1),
class = c(rep(c(rep("t-logistic", 4), rep("NSC", 4),
rep("Poisson", 4), rep("PCC", 4), rep("Sparse PCC", 4),
rep("Sup. PCC", 4), rep("Sparse PLS", 4), rep("SVM", 4)), 5)),
cat = c(rep(c("A", "B", "C", "D"), 40)))
df1 <- df %>%
group_by(class, cat) %>%
summarize(mean = mean(num), sd = sd(num))
ggplot(df1, aes(class, mean, color = cat))+
geom_point(position = position_dodge(width = 0.6))+
geom_errorbar(aes(class, ymin = (mean - 2*sd), ymax = (mean + 2*sd)),
position = position_dodge(width = 0.6))+
theme_bw()