[R] Conditional density plot in lattice

Dieter Menne dieter.menne at menne-biomed.de
Fri Jan 22 11:08:31 CET 2010



Deepayan Sarkar wrote:
> 
> With a restructuring of the data:
> 
> df1 = data.frame(x=0:n, y1=((0:n)/n)^2, y2=1-((0:n)/n)^2, age="young")
> df2 = data.frame(x=0:n, y1=((0:n)/n)^3, y2=1-((0:n)/n)^3, age="old")
> df = rbind(df1, df2)
> 
> xyplot((y1+y2) + y1 ~ x | age, data=df, type = "l")
> 
> xyplot((y1+y2) + y1 ~ x | age, data=df, type = "l",
>        scales = list(axs = "i"),
>        panel = panel.superpose,
>        panel.groups = function(x, y, fill, ...) {
>            panel.polygon(c(min(x), x, max(x)), c(0, y, 0), fill = fill)
>        })
> 
> 

Thanks, Deepayan. I noted, that the color of the bands is determined by
"superpose.symbol". Is that by design or typo?

Dieter


-- 
View this message in context: http://n4.nabble.com/Re-R-Conditional-density-plot-in-lattice-tp1050017p1099911.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list