[R] Trellis Conditional contourplot

hadley wickham h.wickham at gmail.com
Fri Oct 27 14:35:42 CEST 2006


> Finally I got the unreasonable contour plotted.
>
>   http://www.geocities.com/useebi/data/kdecontour.jpeg
>
>   The codes to get the plot,
>
>   cdplot2d(survived ~ age + sibsp, data = titanic3)
>
>   are in http://www.geocities.com/useebi/data/cdplot2d.txt
>
>   One step that I couldn't accomplish as in cdplot is to eliminate those undefined conditional densities outside the ranges of the two covariates.  The plot dosen't make sense for areas with no x and y observation.  Probably, this is why the goal did not sound like anything reasonable.


You can do something pretty similar with ggplot:
qplot(age, sibsp, . ~ survived,  data=titanic3, type=c("jitter","2density"))

(except clearly the density calculation is very different)

Hadley



More information about the R-help mailing list