網站首頁 編程語言 正文
分組設置顏色
library(forestplot) fn <- local({ i = 0 function(..., clr.line, clr.marker){ i <<- i + 1 if(i%%4==3){fpDrawNormalCI(..., clr.line = "#000000", clr.marker = "#00B9BF")} #4組中的第3組 else if(i%%4==0){fpDrawNormalCI(..., clr.line = "#000000", clr.marker = "#C26EFF")} #4組中的第4組 else if(i%%4==2 ){fpDrawNormalCI(..., clr.line = "#000000", clr.marker = "#6DA500")} #4組中的第2組 else(fpDrawNormalCI(..., clr.line = "#000000", clr.marker = "#F9675C")) #4組中的第1組 } }) tabletext=cbind(c("Outcomes",figure_2_data$Treatmeant),c("CI (95%OR)",figure_2_data$`OR (95% CI)*`),c("P Value", figure_2_data$P)) forestplot(labeltext=tabletext,graph.pos = 2,mean = c(NA,figure_2_data$OR),lower = c(NA,figure_2_data$Low),upper = c(NA,figure_2_data$High),boxsize = 0.5, txt_gp=fpTxtGp(label=gpar(cex=1.25), ticks=gpar(cex=1.1), xlab=gpar(cex = 1.2), title=gpar(cex = 1.2)),zero = 1,align = "l", is.summary = c(T,T,F,F,F,F,T,F,F,F,F,T,F,F,F,F,T,F,F,F,F), col = fpColors(box = c("darkblue","darkred")), fn.ci_norm = fn, colgap = unit(8,"mm"), graphwidth = unit(12,"cm") )
效果圖
給每行增加輔助線
line_list_Insuf1=list() for (i in 1:84) { exprs=paste0("line_list_Insuf1$`",i,"`=gpar(lwd=1, columns=1:5, col = '#99999922')") eval(parse(text=exprs)) } line_list_Insuf1$`1`=gpar(lwd=2, columns=1:7, col = '#202020') line_list_Insuf1$`2`=gpar(lwd=2, columns=1:7, col = '#202020') # parse 將character轉換為expression # eval 執行 expression # forestplot 函數里面再加上這句參數 hrzl_lines = line_list_Insuf1
原文鏈接:https://blog.csdn.net/Alleine/article/details/118336110
相關推薦
- 2022-05-18 Jenkins使用publish?html?report插件展示HTML報告的方法_相關技巧
- 2022-06-28 詳解Python中遞歸函數的原理與使用_python
- 2023-04-26 numpy數組切片的使用_python
- 2022-10-22 Android使用ViewStub實現布局優化方法示例_Android
- 2022-07-04 詳解Python字符串原理與使用的深度總結_python
- 2022-05-10 torch.cuda.is_available()返回false最終解決方案
- 2022-05-22 flex彈性布局詳解_Flex
- 2022-08-07 Go?gRPC超時控制Deadlines用法詳解_Golang
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支