0

我为 Forestplot 准备了代码,但是在导出带有“≥”/更多或等号的绘图时遇到问题。

library(forestplot)
names6 <- c("Variable",
           "A ≥ 4000***",
           "B ≥ 50***",
           "C**",
           "D",
           "E***",
           "F",
           "G*",
           "H**",
           "I*",
           "J***")

coef6 <- c(0.42, 1.58, 1.35, 0.49,
           0.46, 0.66, 0.62, 1.34, 0.52, 0.72)

low6 <- c(0.34, 1.29, 1.08, 0.21,
          0.33, 0.44, 0.43, 1.08, 0.29, 0.61)

high6 <- c(0.51, 1.93, 1.69, 1.21,
           0.64, 0.99, 0.91, 1.66, 0.92, 0.86)
boxsize6 <-c(0.2, 0.2, 0.2,0.2,
             0.2,0.2, 0.2,0.2,
             0.2, 0.2)
test_data <- data.frame(coef=coef6,
                        low=low6,
                        high=high6,
                        boxsize=boxsize6)
row_names <- cbind(names6,
                   c("OR",test_data$coef), c("CI-95%",  test_data$low), c("CI+95%", test_data$high) )
test_data <- rbind(NA, test_data)


#####FIGURE
forestplot(labeltext = row_names,
           mean = test_data$coef, upper = test_data$high,
           lower = test_data$low,
           is.summary=c(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE),
           boxsize = test_data$boxsize,
           zero = 1,
           xlog = FALSE,
           xlab = "OR (95% CI)",
           col = fpColors(lines="black", box="black"),
           ci.vertices = TRUE,
           xticks = c(0,0.5, 1, 1.5, 2.0),
           colgap = unit(0.03,'npc'),
           lineheight = unit(1.1,"cm"),
           txt_gp=fpTxtGp(label = gpar(cex = 0.8),
                          title = gpar(cex = 1),
                          ticks = gpar(cex = 0.6),
                          xlab = gpar(cex = 0.7)))

但是,我无法将绘图导出为当前“≥”/更多或相等的 .pdf 文件。

而不是这个,我得到了符号“=”/等于。我应该改变什么才能让这个标志出现在情节上?

编辑:\u2265 不起作用...

4

1 回答 1

1

此解决方案可能是特定于系统的。这是适用于Windows的东西:

library("forestplot")
library("withr")

names6 <- c("Variable",
            "A \u2265 4000***",
            "B \u2265 50***",
            "C**",
            "D",
            "E***",
            "F",
            "G*",
            "H**",
            "I*",
            "J***")

### Data & params code here....

with_cairo_pdf('forestplot.pdf',

  ### Forest plot code here....
  forestplot(labeltext = row_names,
             ....)
)
于 2019-03-23T23:33:06.120 回答