R 使用ggplot2对森林地块进行调整
我试图根据荟萃分析结果在R中创建一个森林图。但是,我很难调整线的厚度和中心点,也很难摆脱自动图例,也很难创建自己的图例R 使用ggplot2对森林地块进行调整,r,ggplot2,R,Ggplot2,我试图根据荟萃分析结果在R中创建一个森林图。但是,我很难调整线的厚度和中心点,也很难摆脱自动图例,也很难创建自己的图例 #d is a data frame with 4 columns #d$x gives variable names #d$y gives center point #d$ylo gives lower limits #d$yhi gives upper limits #data d <- data.frame(x = tou
#d is a data frame with 4 columns
#d$x gives variable names
#d$y gives center point
#d$ylo gives lower limits
#d$yhi gives upper limits
#data
d <- data.frame(x = toupper(letters[1:10]),
y = rnorm(10, 0, 0.1))
d <- transform(d, ylo = y-1/10, yhi=y+1/10)
d$x <- factor(d$x, levels=rev(d$x)) #Reverse ordering in the way that it's is in the
#function
credplot.gg <- function(d){
require(ggplot2)
p <- ggplot(d, aes(x=x, y=y, ymin=ylo, ymax=yhi,group=x,colour=x))+
geom_pointrange()+ theme_bw()+ coord_flip()+
guides(color=guide_legend(title="Cohort"))+
geom_hline(aes(x=0),colour = 'red', lty=1)+
xlab('Cohort') + ylab('Beta') + ggtitle('rs6467890_CACNA2D1')
return(p)
}
credplot.gg(d)
#d是一个包含4列的数据帧
#d$x给出变量名
#d$y给出中心点
#d$YO给出了较低的限制
#d$yhi给出了上限
#资料
如果您提供数据并一致使用代码标记,您将得到更好的响应。请参阅此链接,以帮助设置问题的格式,使其可重复:此外,如果您接受了之前给出的一些答案,我很抱歉,我遗漏了数据,现在添加了这些数据