Hi
Here's one way to approach it ...
ggplot(data.frame(x=1:10, y=1:10)) +
geom_polygon(aes(x=xx, y=yy), fill="grey70",
data=data.frame(xx=c(0, 0, 4, 4), yy=c(0, 11, 11, 0))) +
geom_point(aes(x=x, y=y))
... (supply a separate data source for the background region polygon).
Paul
On 4/06/2012 4:18 a.m., Dominic Comtois wrote:> I'd like to create a plot similar to this one from Kochanska et al.
> (Development and Psychopathology, 2011):
>
>
>
> <http://pages.videotron.com/do999/r-help/Kochanska_graph_ros.jpg>
> http://pages.videotron.com/do999/r-help/Kochanska_graph_ros.jpg
>
>
>
> I am new to ggplot2 and can't see any obvious way to create distinct
> coloured regions for the background, nor can I find any relevant examples.
>
>
>
> Any guidance appreciated.
>
>
>
> DC
>
>
>
> PS: The context is practically the same as the one from the image (Gene x
> Environment interaction study). I used the following tool to find the
> regions of significance, if this is of interest to anyone:
> <http://www.quantpsy.org/interact/mlr2>
> http://www.quantpsy.org/interact/mlr2
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/