因为文章需要,通宵达旦好几天才学会了R语言的一点皮毛。现在遇到一个非常棘手的问题:
图像中纵坐标并能没有按照我规定的顺序显示 (顺序为"Hypertension(+)","Hypertension(-)","obesity(+)","obesity(-)", "Dyslipidemia(+)","Dyslipidemia(-)","central obesity(+)","central obesity(-)")图在附件中
请问如何解决?{:3_61:}
静候大神详细解答! 谢谢!
[em23][em23][em23]
我的代码:
library(ggplot2)
OR<-c(.508,.734, .654, .626, .610, .694, .567, .214)
lower<-c(.340, .587, .308, .447, .475,.386, .348, .031)
upper<-c(.759,.919, 1.392, .877, .784, 1.248, .925, 1.478)
type<-c(1,1)
odds<-data.frame(OR, lower, upper,type)
vars<-c("Hypertension(+)","Hypertension(-)","obesity(+)","obesity(-)","Dyslipidemia(+)","Dyslipidemia(-)","centralobesity(+)","central obesity(-)")
ticks<-c(seq(.1,1, by =.1), seq(0, 10, by =1), seq(10, 100, by =10))
a1<-ggplot(odds, aes(y= OR, x =reorder(vars, OR))) +scale_y_log10()
a2<-a1+geom_point(size=3)
a3<-a2+geom_errorbar(aes(ymin=lower,ymax=upper), width=.05)
a4<-a3
a5<-a3+geom_hline(yintercept = 1,linetype=2)
a6<-a5+coord_flip()+ facet_wrap(~type,nrow=2)
a7<-a6+labs(title = "", x ="", y = "Odds ratio for DM")
a8<-a7+theme_bw()
a8


雷达卡






京公网安备 11010802022788号







