In 2009, I wrote about
a way to show density plots along both dimensions of a plot. When I ran the code again to adapt it to a new project, it didn't work because ggplot2 has become better in the meantime. Below is the updated code. Using the
gridExtra package and
this hint from the ggplot2 wiki, we get this output:
Source code:
1 comment:
Thanks for this. To my eyes, replacing:
stat_density(fill = NA, position="dodge")
with:
geom_line(stat="density", position="dodge")
Looks much better.
Post a Comment