I would like to plot the data below as geom_rect
using ggplot2
in R
. Is it possible to plot some that overlaps under each other? It is a bit tricky for me as to plot geom_rect
it is needed to specify the ymin
and ymax
. Any help is so appreciated!
chr start stop
a 3 7
a 6 8
a 5 10
a 12 14
b 6 8
b 3 8
b 2 5
b 2 5
Genes <- ggplot(mydata, aes(xmin=start,ymin=0.20,xmax=stop,ymax=0.50),inherit.aes=FALSE) +
xlab("position") +
geom_rect(color="black") +
theme(legend.position="none") +
theme_bw() +
theme(text=element_text(size=10)) +
facet_wrap(~chr, ncol = 2, strip.position = "right")
plot(Genes)