2014-01-21 123 views
0

我在rmetaforestplot做了陰謀。請注意橫軸有0.2和7。我怎麼能在1,2,3,4,5添加刻度線沒有標籤和6 之間沒有刻度標記和標籤不標註他們?我只想在這裏打勾。這裏是情節: enter image description here森林圖x軸忽略標籤,但畫刻度線

我如何在0.2,1,2,3,4,5,6和7的蜱,但我只標記在c(0.2,7)?此代碼:

library(rmeta) 
tabletext<-rbind(c("A","3.77"), 
      c("B","1.33"), 
      c("C","1.32"), 
      c("D","1.12"), 
      c("E","1.58"), 
      c("F","0.9")) 
m=c(3.77,1.33,1.32,1.12,1.58,0.9) 
l=c(0.6144,0.644,0.6536,0.4536,1.0116,0.7236) 
u=c(6.9256,2.016,1.9864,1.7864,2.1484,1.0764) 
#overview datafile: 
cbind(tabletext, m,l,u) 
         m  l  u  
[1,] "A"   "3.77" "3.77" "0.6144" "6.9256" 
[2,] "B"   "1.33" "1.33" "0.644" "2.016" 
[3,] "C"   "1.32" "1.32" "0.6536" "1.9864" 
[4,] "D"   "1.12" "1.12" "0.4536" "1.7864" 
[5,] "E"   "1.58" "1.58" "1.0116" "2.1484" 
[6,] "F"   "0.9" "0.9" "0.7236" "1.0764" 
forestplot(tabletext,m,l,u, zero=1, xticks=c(0.2,7),col=meta.colors(box="royalblue",line="darkblue", summary="royalblue")) 

我可以擴展xticks = C(0.2,7)到xticks = C(0.2,1,2,3,4,5,6,7),但隨後的所有標籤在2,3,4,5,6也將被打印,我不想。

+0

而不是'Forest1 < - read.table(file =「Forest_1.txt」,sep =「\ t」,head = TRUE,row.names = 1) ',這對任何人都沒有幫助,您應該給dput(Forest1)的'結果',以使你的代碼重複的。 – ziggystar

+0

謝謝ziggystar,我調整了代碼,要準備好副本,並在窗戶貼上R. – user3219379

回答

0

感謝您的建議。該rmeta沒有這個選項,但我(目前在開發分支1.2.1)已將此添加到森林圖 - 包:

tabletext<-rbind(c("A","3.77"), 
       c("B","1.33"), 
       c("C","1.32"), 
       c("D","1.12"), 
       c("E","1.58"), 
       c("F","0.9")) 
m=c(3.77,1.33,1.32,1.12,1.58,0.9) 
l=c(0.6144,0.644,0.6536,0.4536,1.0116,0.7236) 
u=c(6.9256,2.016,1.9864,1.7864,2.1484,1.0764) 

#overview datafile: 
xticks <- seq(from = 0.2, to = 7, by = .5) 
xlabels <- rep(TRUE, length.out = length(xticks)) 
xlabels[xticks > 2] <- FALSE 
xlabels[length(xlabels)] <- TRUE 
attr(xticks, "labels") <- xlabels 
forestplot(tabletext,new_page = TRUE, 
      m,l,u, 
      zero=1, 
      xticks=xticks, 
      col=fpColors(box="royalblue",line="darkblue", summary="royalblue")) 

enter image description here

使用devtools下載開發版:

devtools::install_github("gforge/forestplot", ref="develop")