我在使用 R 中的森林情节包时遇到了困难。这是我的代码。实际上,除了传说之外,一切都很好。 . 然而对于传说,我想要一个蓝色圆圈,一个红色方块和一个绿色的 losange 而不是 3 个方块。
任何想法?提前致谢。彼得
library(forestplot)
test_data <- data.frame(coef1=c(0.54,0.72,0.57),
coef2=c(0.59,0.79,0.58),
coef3=c(0.49,0.60,0.48),
low1=c(0.41,0.46,0.42),
low2=c(0.44,0.49,0.42),
low3=c(0.37,0.37,0.35),
high1=c(0.72,1.12,0.77),
high2=c(0.78,1.26,0.80),
high3=c(0.65,0.99,0.66))
col_no <- grep("coef", colnames(test_data))
row_names <- list(
list("Behavioral CVH","Biological CVH","Total CVH"))
coef <- with(test_data, cbind(coef1, coef2, coef3))
low <- with(test_data, cbind(low1, low2, low3))
high <- with(test_data, cbind(high1, high2, high3))
forestplot(row_names, coef, low, high,
title="Paris Prospective Study 3",
fn.ci_norm=matrix(c("fpDrawCircleCI", "fpDrawNormalCI","fpDrawDiamondCI"),
nrow = 3, ncol=3, byrow=T),
zero = c(1), boxsize=0.05,
col=fpColors(box=c("royalblue", "gold", "black"),
line=c("darkblue", "orange", "black"),
summary=c("darkblue", "red", "black"),
hrz_lines = "#444444"),
xlab="Odds ratio & 95% Confidence intervals",
vertices = TRUE,
new_page = TRUE,
legend=c("Q2 vs. Q1","Q3 vs. Q1","Q4 vs. Q1"),
legend_args = fpLegend(pos = list("topright"),
title="Legend",
r = unit(0, "snpc"),
gp = gpar(col="#CCCCCC", lwd=1.5)))