我正在使用beeswarm
来绘制我的数据。
d<-data.frame(Cond=c(WT,WT,KO,KO),Count=c(1,2,3,4))
beeswarm(Count ~ Cond, data = d)
这会产生以下图像。
如何手动指定x轴,以便WT在KO之前出现?
答案 0 :(得分:2)
d<-data.frame(Cond=c("WT","WT","KO","KO"),Count=c(1,2,3,4))
#turn into a factor with manual specification of levels
d$Cond <- factor(d$Cond,levels=c("WT","KO"))
#plot
beeswarm(Count ~ Cond, data = d)
答案 1 :(得分:1)
有很多关于here
的内容d<-data.frame(Cond=c('WT', 'WT', 'KO', 'KO'),Count=c(1,2,3,4))
library(beeswarm)
beeswarm(Count ~ Cond, data = d)
f <- ordered(d$Cond, levels = c("WT", "KO"))
beeswarm(Count ~ f, data = d)