I have a ggplot chart
q3 <- ggplot(y, aes(T,C))+ geom_line()
and the kernel density
den <-density(y$C)
How can I overlay a kernel density chart on the y axis?
Thanks for your help
I have a ggplot chart
q3 <- ggplot(y, aes(T,C))+ geom_line()
and the kernel density
den <-density(y$C)
How can I overlay a kernel density chart on the y axis?
Thanks for your help
Following up on DWin's idea, this might be the sort of thing you're looking for:
dat <- data.frame(x = 1:100,
y = 1:100,
z = rnorm(100))
ggplot(dat) +
geom_point(aes(x = y/100,y = x/100)) +
geom_density(aes(x = z)) +
coord_flip()
Note the reversal of the x
and y
aesthetics in geom_point
.