Reputation: 71
I'm trying to plot densities on both sides of the x axis - trying to visualize reads mapping to both strands of a genomic region.
I have two problems :
I want to use ggplot2
but
I don't know how to extract the data from the plot object, or invert the plot that has already been made.
Any help greatly appreciated!
Upvotes: 0
Views: 1283
Reputation: 173627
Your question is very unclear, but I found the "densities on both sides of the x axis" potentially interesting. So maybe you're trying to do something like this:
d <- data.frame(x = rnorm(1000),x1 = rnorm(1000,sd = 0.5))
ggplot(data = d,aes(x = x)) +
geom_density() +
geom_density(aes(x = x1,y = -(..density..)))
Upvotes: 6