cex.axis不会改变森林图中的刻度尺寸

时间:2015-12-01 16:07:40

标签: r forestplot

我正在使用以下数据处理林图:

library(forestplot)

####With this I create the data for the tabletext###
TE<-as.character(c(-0.05, 0.27, 0.39, 0.21, 0, 0.08, 0.28, 0.23, -0.16, 0.11, 0.13,
                 0.03, 0.78, 0.43, 0.07, 0.34, 0.58))
Inferior<-as.character(c(-0.55, -0.22, -0.11, -0.3, -0.31, -0.22, -0.03, -0.07, -0.47,
                       -0.19, -0.18, -0.27, 0.46, 0.12, -0.55, -0.07, 0.15))
Superior<-as.character(c(0.44, 0.76, 0.88, 0.73, 0.31, 0.39, 0.6, 0.54, 0.15, 0.42, 
                         0.45, 0.34, 1.11, 0.74, 0.69, 0.75, 1.02))
Autor<-c("Cain & Smith", "Cain & Smith", "Cain & Smith", "Cain & Smith", 
         "Hoffman & Dangl", "Hoffman & Dangl", "Hoffman & Dangl", "Hoffman & Dangl",
         "Hoffman & Dangl", "Hoffman & Dangl", "Hoffman & Dangl", "Hoffman & Dangl",
         "Hoffman & Dangl", "Hoffman & Dangl", "Bunch", "Bunch", "Bunch")

###With this I create the values for the forest plot###
TE2<-c(NA, -0.05, 0.27, 0.39, 0.21, 0, 0.08, 0.28, 0.23, -0.16, 0.11, 0.13,
       0.03, 0.78, 0.43, 0.07, 0.34, 0.58, NA, 0.29)
Inferior2<-c(NA, -0.55, -0.22, -0.11, -0.3, -0.31, -0.22, -0.03, -0.07, -0.47,
             -0.19, -0.18, -0.27, 0.46, 0.12, -0.55, -0.07, 0.15, NA, 0.12)
Superior2<-c(NA, 0.44, 0.76, 0.88, 0.73, 0.31, 0.39, 0.6, 0.54, 0.15, 0.42, 0.45,
             0.34, 1.11, 0.74, 0.69, 0.75, 1.02, NA, 0.46)

###With this I create the sidetable###
tabletext<-cbind(
  c("Autor", Autor, NA, "Summary"),
  c("ES", TE, NA, "0.29"),
  c("IIC", Inferior, NA, "0.12"),
  c("SIC", Superior, NA, "0.46"))

数据表和图表的一切都很好,但cex.axis参数似乎不适用于我在下面提供的forestplot代码。

###With this I create the forestplot###
forestplot(tabletext, 
           hrzl_lines = gpar(col="#444444"),
           mean = TE2, lower = Inferior2, upper = Superior2, 
           txt_gp = fpTxtGp(label = gpar(fontfamily = "Arial"), cex = 0.8),
           new_page = TRUE,
           xlog=FALSE,
           is.summary=c(TRUE, rep(FALSE,18), TRUE),
           graph.pos=5,
           boxsize=0.2,
           cex.axis=2,
           col=fpColors(box="black",line="black", summary="black"))

感谢您的帮助。

谢谢,

布拉德利

1 个答案:

答案 0 :(得分:3)

您也可以更改fpTxtGp()函数中的参数。我会推荐这样的东西:

own <- fpTxtGp()
own # see all parameters
own$ticks$cex <- 2 #tick labels

或一行中的所有内容:

own <- fpTxtGp(label = gpar(fontfamily = "Arial"),ticks = gpar(cex=2))

和情节:

forestplot(tabletext, 
       hrzl_lines = gpar(col="#444444"),
       mean = TE2, lower = Inferior2, upper = Superior2, 
       txt_gp = own,
       new_page = TRUE,
       xlog=FALSE,
       is.summary=c(TRUE, rep(FALSE,18), TRUE),
       graph.pos=5,
       boxsize=0.2,
       col=fpColors(box="black",line="black", summary="black"))