本文介绍了R平均值和标准偏差的手动箱线图(ggplot2)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我有两组平均得分和标准偏差,代表我们对平均估计的信心。注意:我没有原始分数,仅表示从模型输出的估计值和从模型输出的估计值的SD,在该平均值附近。I have two groups with mean scores and standard deviations which represent how confident we are with the mean estimates. Note: I do not have raw scores, just mean estimates outputted from a model and the SD of the estimates outputted from the model, around that mean.我有一个特征设置为20左右,我想针对每个功能比较我两组的平均值+/-标准偏差。基本上看起来像这样:I have a feature set around 20, and I want to compare for each feature the mean +/- standard deviations of each of my 2 groups. It will essentially look like this: ggplot ()似乎可以处理包含原始数据的数据,并且可以从每个要素的数组计算平均值和标准差。 boxplot()的工作原理类似。ggplot() seems to work with data that has the raw data and it calculates the mean and standard deviation from the arrays of each feature. boxplot() works similarly.有人可以帮助我找到一种以这种方式可视化我的结果的方法吗?Can anyone help me figure out a way to visualize my results in this way?推荐答案在这种情况下,我不希望您使用箱线图。您可以使用 ggplot2 包中的 geom_errorbar 之类的东西。请提供数据或示例数据以使您的问题可重复。I don't think you want a boxplot in this case. You could use something like geom_errorbar from the ggplot2 package. Please provide data or sample data to make your question reproducible.df <- data.frame(means = rnorm(20, 5, 2), sds = rnorm(20), feats = c(paste0("Feature ", letters[1:10])), group = rep(c("group 1", "group 2"), each = 2))head(df)# means sds feats group# 1 7.298374 -1.1545645 Feature a group 1# 2 6.124870 -0.0694843 Feature b group 1# 3 3.855704 0.3802556 Feature c group 2# 4 6.357659 2.2822757 Feature d group 2# 5 3.572474 -0.9488784 Feature e group 1# 6 3.526351 2.5956482 Feature f group 1library(ggplot2)ggplot(df, aes(x = feats, color = group)) + geom_errorbar(aes(ymax = means + sds, ymin = means - sds), position = "dodge") 这篇关于R平均值和标准偏差的手动箱线图(ggplot2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-15 16:44