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: