[R] Conditional density plot in lattice

Jim Lemon jim at bitwrit.com.au
Fri Jan 22 03:54:49 CET 2010


On 01/22/2010 04:05 AM, Dieter Menne wrote:
> Dear group,
>
> I want to create a plot similar to cdplot or cd_plot I vcd :
>
> http://addictedtor.free.fr/graphiques/graphcode.php?graph=120
>
> with lattice and support for multiple panels. Densities should not be
> computed, these are stored in a data frame as in the example. My current
> workaround with barchart and ugly jags is given.
>
>
Hi Dieter,
I know this is cheating, but what about:

library(plotrix)
stackpoly(cbind(df3$y,df1$y,rep(1,101)),
  col=c("#ccffff","#ffffcc","#ffccff"),
  xlab="Age",ylab="Proportion",
  main="The folly of youth, the tragedy of age")
legend(20,0.8,c("Young","Old"),
  fill=c("#ffffcc","#ccffff"),bg="white")

Jim



More information about the R-help mailing list