gforge / forestplot

Advanced forest plots in R using grid graphics
44 stars 15 forks source link

How to show x axis in log scale? #22

Closed ShixiangWang closed 6 years ago

ShixiangWang commented 6 years ago

Hello @gforge,

I want to show x-axis in log scale but don't know how to do it.

image

You can see that the upper value is larger than lower bound, these values represent HRs.

I tried using xlog option you provide but failed with message:

Error in forestplot.default(fn.ci_norm = fpDrawCircleCI, forest_APM[,  : 
  All argument values (mean, lower, upper, zero, grid and clip) should be provided as exponentials when using the log scale. This is an intentional break with the original forestplot function in order to simplify other arguments such as ticks, clips, and more.

But HRs did come from coxph model result elements like exp(coef), lower.95 and upper .95 as following example.

> coxph(Surv(time, status) ~ sex, data = lung) %>% summary()
Call:
coxph(formula = Surv(time, status) ~ sex, data = lung)

  n= 228, number of events= 165 

      coef exp(coef) se(coef)     z Pr(>|z|)   
sex -0.531     0.588    0.167 -3.18   0.0015 **
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

    exp(coef) exp(-coef) lower .95 upper .95
sex     0.588        1.7     0.424     0.816

Concordance= 0.579  (se = 0.022 )
Rsquare= 0.046   (max possible= 0.999 )
Likelihood ratio test= 10.6  on 1 df,   p=0.001
Wald test            = 10.1  on 1 df,   p=0.001
Score (logrank) test = 10.3  on 1 df,   p=0.001

I just want to show x-axis in log scale and not change any values in order to balance the show of confience interval. How should I do?

Thanks for your package and thank you.

Shixiang

gforge commented 6 years ago

Sorry but this question is something for StackOverflow

ShixiangWang commented 6 years ago

... okay