1

当我尝试更改使用 ggforest(来自 survminer 包)生成的森林图中的轴时,该图完全改变了。

例如:

#Example data set
mydata <- data.frame(A = c(8, 6, 42, 97, 55, 1, 5, 7, 55, 4), 
                     B = c(93, 9, 65, 2, 51, 89, 1, 1, 5, 62), 
                     C = c(68.41, 68.86, 47.26, 31.06, 42.97, 69.16, 47.39, 56.57, 19.63, 45.58),
                     D = c(0, 0, 0, 1, 1, 0, 0, 0, 0, 0),
                     time = c(1.6, 34.6, 1.5, 35.8, 7.7, 38.6, 40.2, 4.7, 37.6, 8.6), 
                     event= c(1, 0, 0, 0, 1, 0, 0, 1, 0, 1))


OS <- mydata$time
Event<-mydata$event
A<-mydata$A
B<-mydata$B
C<-mydata$C
D<-mydata$D


# load packages
library("survival")
library("survminer")

# dependent and independent variables
y <- Surv(OS, Event)
x <- cbind(A, B, C, D)  

#cox regression
cox<-coxph(y~x, data=mydata, method= "breslow")
summary(cox)


#Forest PLot using surv miner

ggforest(cox, alpha = 0.05, plot.title = "Forest plot for Cox proportional hazard model")

产生这个情节

如果我尝试改变轴,就像这样..

ggforest(cox, alpha = 0.05, plot.title = "Forest plot for Cox proportional hazard model", xlim=c(-10,10000))

..它看起来像这样 有谁知道解决这个问题?

4

1 回答 1

0

这是基于选项的解决coord_flip方案ylim

ggforest(cox, alpha = 0.05, plot.title = "Forest plot for Cox proportional hazard model") +
     coord_flip(ylim=c(10^(-4),10^6))

在此处输入图像描述

于 2017-05-15T23:00:58.120 回答