[R] Create patterns within a plot?

Jim Lemon jim at bitwrit.com.au
Thu Mar 14 12:18:54 CET 2013


On 03/14/2013 09:19 PM, Öhagen Patrik wrote:
>
> Please note that I want to use log-scale on the x-axis which makes the polygon function sad.
>
> Cheers, Patrik
>
>
> -----Ursprungligt meddelande-----
> Från: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] För Öhagen Patrik
> Skickat: den 14 mars 2013 08:47
> Till: R hELP
> Ämne: [R] Create patterns within a plot?
>
>
>
> Dear All,
>
> As an attempt to highlight the overall pattern in a Forest plot, I would like to "highlight" the area around HR=1. I cannot find any simple tools for painting a grey ribbon between 0.9 and 1.1. Any suggestions?
>
Hi Patrik,
This is a bit indirect, but it may do what you want. The example plot is 
from the metafor package (see forest.default):

forest(dat$yi, dat$vi)
library(plotrix)
gradient.rect(0.9,-0.1,1.1,14,
  reds=c(1,0.5,1),greens=c(1,0.5,1),
  blues=c(1,0.5,1),gradient="x",border=NA)
par(new=TRUE)
forest(dat$yi, dat$vi)

Jim



More information about the R-help mailing list