[R] metaplot in rmeta: y-axis disappears
David Scott
d.scott at auckland.ac.nz
Thu Aug 13 00:55:10 CEST 2009
Roaman wrote:
> Thank you, the x-axis includes zero, but even, when I try to plot it not
> including zero, the y-axis kepps
> disappearing. One can't even add the axis afterwards!
>
> Here is an example:
>
> library(rmeta)
>
> set.seed(123)
>
> # simulated data:
> ############
> theta <- 0.5
> sds <- runif(50,0.8,8)
> b <- rnorm(50,0,0.3)
> e <- sapply(sds, function(x) rnorm(1,0,sds))
> theta_i <- theta + b + e
>
> # funnel plot:
> #########
> plot(1/(sds^2),theta_i)
>
> # short break:
> #########
> Sys.sleep(3)
>
> # metaplot:
> ########
> metaplot(mn = theta_i, se = sds,xlim=c(5,20))
>
> # plot funnel plot again:
> ################
> plot(1/(sds^2),theta_i)
>
> # ---> y-axis disappeared!
>
> # try to add y-axis:
> #############
> axis(2, at=-4:7, labels=-4:7)
>
> # ---> nothing happens.
>
OK with some code it is possible to track this down and fairly easily
too. Clearly metaplot altered something and you can guess that it would
be some graphical parameter or possibly some option.
If you compare the output of par() before and after calling metaplot you
will see one thing which is likely to cause a problem. yaxt has changed
from having value "s" to having value "n".
If you do
par(yaxt="s")
axis(2, at=-4:7, labels=-4:7)
you should see the axis again.
This appears to be developer error: metaplot should restore parameters
like this to what they were before it was called. Looking at the code
xaxt is restored to its previous value, but not yaxt. I am not sure why
either of them needs to be changed however outside of the call to plot.
I have copied this to Thomas.
David
_________________________________________________________________
David Scott Department of Statistics
The University of Auckland, PB 92019
Auckland 1142, NEW ZEALAND
Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055
Email: d.scott at auckland.ac.nz, Fax: +64 9 373 7018
Director of Consulting, Department of Statistics
More information about the R-help
mailing list