我想通过ggplot2将点图中的中值设置得更大以便于比较系列。
KO.gyne.gem.face<-c(0.239, NA, NA, 0.058, 0.089, 0.072, 0.150, 0.053, 0.092, 0.076)
KO.worker.gem.face<-c(0.409, 0.564, 0.379, NA, 0.279, 0.272, 0.65, NA, NA, NA)
KO.worker.inv.face<-c(NA, NA, NA, 0.467, 0.506, NA, 0.850, NA, NA, NA)
KO.gyne.inv.face<-c(0.158, 0.054, 0.153, 0.18, 0.268, 0.22, 0.144, 0.244, 0.271, 0.162)
KO.gyne.pure.face<-c(0.313, 0.046, 0.185, 0.048, 0.184, 0.269, 0.056, 0.332, 0.268, 0.279)
KO.cis.inv.face<-c(0.073, 0.069, 0.016, 0.016, 0.036, 0.016, 0.016, 0.016, 0.016, 0.016)
KO.trans.inv.face<-c(0.105, 0.076, NA, 0.069, 0.065, 0.082, 0.537, 0.057, 0.089, 0.016)
KO.synth.cis.C11<-c(0.066, 0.222, 0.074, 0.315, 0.07, 0.199, 0.231, 0.05, 0.222, 0.077)
KO.synth.trans.C11<-c(0.229, 0.246, NA, 0.184, 0.706, 0.196, 0.541, NA, 0.483, 0.127)
KO.synth.cis.C13<-c(0.350, 0.583, NA, 0.542, 0.933, NA, 0.146, 0.472, 0.194, 0.644)
KO.synth.trans.C13<-c(0.050, 0.083, NA, NA, NA, 0.369, NA, NA, NA, 0.483)
KO.synth.inv.face<-c(NA, 0.09, 0.175, NA, 0.118, 0.627, 0.158, 0.094, 0.026, 0.563)
KO.synth.gem.face<-c(0.104, 0.117, 0.115, 0.036, 0.039, 0.113, 0.152, 0.142, 0.024, 0.076)
KO.synth.nicotine<-c(0.008, 0.008, 0.008, 0.008, 0.008, 0.008, 0.008, 0.008, 0.008, 0.008)
KO.times<-data.frame(mget(ls(pattern="KO.")))
ggplot(data=melt(KO.times), aes(x=value, y=variable))+#work on this base
geom_point()
所有点目前都有相同的尺寸;我想让中位数更大一些。有任何想法吗?提前谢谢。
答案 0 :(得分:2)
使用例如summary
stat来计算均值。我们需要翻转,因为我们只能用x来概括y,而不是相反:
ggplot(data=data.table::melt(KO.times), aes(variable, value))+#work on this base
geom_point() +
geom_point(size = 5, stat = 'summary', fun.y = function(x) median(x, na.rm = TRUE)) +
coord_flip()
请注意,对于具有偶数观测值的变量,中位数将不是实际观测值。
答案 1 :(得分:2)