0

Please be tolerant :) I am a dummy user of R and I am using the code and sample data to learn how to make forest plot that was shown in the previous post -

Optimal/efficient plotting of survival/regression analysis results

I was wondering is it possible to set user-defined x-axis scale with the code shown there? Up to now x a-axis scale is defined somehow automatically. Thank you for any tips.

Community
  • 1
  • 1
Try
  • 111
  • 2
  • 8
  • Short answer: "of course it's possible". How do you want ti changed? Have you done any searching on SO for tweaks to ggplot axes along the lines of what you are requesting? – IRTFM Mar 05 '16 at 16:48
  • @42 Basically, i want to find where in this code i can change x-axis scale, so that, for example, I would set it in the range between 0 and 50. I have looked ggplot2 and tried to do it, but after that code didn't work at all :) – Try Mar 05 '16 at 16:53

1 Answers1

2

I'm unimpressed with the precision of the documentation since one might assume that the limits argument would be values on the relative risk scale rather than on the log-transformed scale. One gets a ridiculous result if that is done. That quibble not withstanding, it's relatively easy to use that parameter to created an expanded plot:

install('devtools')   # then use it to get current package
# executing the install and load of the package referenced at the top of that answer
print(forest_model(lung_cox, limits=log( c(.5, 50) ) ))

enter image description here

Trying for a lower range of 0 on the relative risk scale is not sensible. Would imply a -Inf value on hte log-transformed scale. Trying for lower value, say log(0.001), confuses the pretty printing of the scale in my tests.

IRTFM
  • 258,963
  • 21
  • 364
  • 487
  • Thank you. However, I'm afraid the code you proposed returns an error `unused argument (limits = log(c(0.5, 50)))`. I could suggest that it is because `limits` are not used in above mentioned code? – Try Mar 05 '16 at 17:35
  • You probably don't have a current version of the package. Since I just installed it today from github, and then rebooted R to let the ggplot2 update take effect, I'm reasonably confident that I do. – IRTFM Mar 05 '16 at 17:38