I would like to add manual labels across the top of my plot to define vertical lines. Each "panel" represents a chromosome.
My plot:
Before using geom_vline()
I tried playing with facet_grid()
and the labeling was perfect but the X-axis was not proportional to the chromosome length even with the scales = "free_x
and space = "free_x"
arguments (see previous post for extra details/codes/links to plots)
Plot with facet_grid
:
Now I would like to manually add labels to similarly look like the facet_grid
panel labels.
I have tried playing with annotate
and geom_text
and the best idea I have is to use geom_text
with each panel label having its own line of code(?) and now the code is sucking memory/not working.
Code to generate base plot can be found at Plotting coverage depth in 1kb windows?.
To add panel labels:
label.plot <- Xdepth.average.plot +
geom_text(aes(x=115109, y=200, label="I"), colour="black") +
geom_text(aes(x=636810, y=200, label="II"), colour="black") +
geom_text(aes(x=1201712, y=200, label="III"), colour="black") +
geom_text(aes(x=2125989, y=200, label="IV"), colour="black") +
geom_text(aes(x=3180392, y=200, label="V"), colour="black") +
geom_text(aes(x=3603910, y=200, label="VI"), colour="black") +
geom_text(aes(x=4284460, y=200, label="VII"), colour="black") +
geom_text(aes(x=5111252, y=200, label="VIII"), colour="black") +
geom_text(aes(x=5612517, y=200, label="IX"), colour="black") +
geom_text(aes(x=6205337, y=200, label="X"), colour="black") +
geom_text(aes(x=6911620, y=200, label="XI"), colour="black") +
geom_text(aes(x=7784117, y=200, label="XII"), colour="black") +
geom_text(aes(x=8785421, y=200, label="XIII"), colour="black") +
geom_text(aes(x=9639803, y=200, label="XIV"), colour="black") +
geom_text(aes(x=10577615, y=200, label="XV"), colour="black") +
geom_text(aes(x=11597293, y=200, label="XVI"), colour="black")
label.plot