An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130314/604da1ae/attachment.pl>
Create patterns within a plot?
5 messages · Öhagen Patrik, Sarah Goslee, Jim Lemon +1 more
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? Thank you in advance! Cheers, Patrik ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130314/a7cf0cc7/attachment.pl>
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
Same idea, but just using base graphics and using an x-axis with log units: library(metafor) data(dat.bcg) res <- rma(measure="OR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg, slab=paste(dat.bcg$author, dat.bcg$year, sep=", ")) forest(res, cex=.9, at=log(c(.05, .25, 1, 4)), xlim=c(-10,7), atransf=exp) rect(log(0.5), 0.1, log(1.5), 13.9, col="gray90", border=NA) par(new=TRUE) forest(res, cex=.9, at=log(c(.05, .25, 1, 4)), xlim=c(-10,7), atransf=exp) Best, Wolfgang
-----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Jim Lemon Sent: Thursday, March 14, 2013 12:19 To: ?hagen Patrik Cc: R hELP Subject: Re: [R] Create patterns within a plot? 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
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code.