[R] forestplot and x axis scale

Pam Murnane pmurnane at gmail.com
Tue Dec 9 05:21:48 CET 2008

Hello R users,

I would like to create several forestplots with the same X axis, so,
if you were to look at the plots lined up all the X axes would be
identical (and the different plots could be compared).  Here is one
version of code I've used:

mytk10<-c(0.1, 0.5, 1, 2, 5, 10)
pdf(file = "myfile.pdf",
     pointsize = 7, paper="letter", width=6, height=9)
forestplot(newcite,or,lcl,ucl,zero=0, graphwidth = unit(1.2,"inches"),
   clip=c(log(0.1),log(10)), xlog=TRUE, xticks=mytk10, xlab="Odds Ratio",
title(main = list("My title", col="darkblue", font=2))

--> I have changed the width of the pdf output and/or the graphwidth
specified in the forestplot function -- and depending on the length of
the text/table descriptions (in the matrix "newcite"), the X axis will
vary (when the text is long, the axis is shorter).  I tried fixing the
axis at a relatively small size (using graphwidth), but it would still
be smaller when I was using data with long "newcite" text.  Do I need
to fix the amount of text for display within "newcite"?

--> A second and less essential question:  I've used mytk10 for the
axis tickmarks/labels - I'd prefer no decimal points for 1,2,5,and 10
- any way to adjust this?

Thanks in advance for any assistance!


More information about the R-help mailing list