Skip to content

Instantly share code, notes, and snippets.

@mikelove
Created May 3, 2023 19:50
Show Gist options
  • Save mikelove/7ccb638df5084d9fabf107b25e07425b to your computer and use it in GitHub Desktop.
Save mikelove/7ccb638df5084d9fabf107b25e07425b to your computer and use it in GitHub Desktop.
Manhattan plot with genes using plotgardener
library(plotgardener)
par <- pgParams(
chrom = "chr1",
chromstart = 8.2e6,
chromend = 8.7e6,
assembly = "hg19",
just = c("left", "bottom")
)
dat <- data.frame(chrom="chr1", pos=840:849 * 1e4 + 1, p=1:10/10)
pageCreate(width = 4, height = 3.5, showGuides = TRUE)
mp <- plotManhattan(dat, params = par, x = .5, y = 1, width = 3, height = .75, range=c(0, 1.1))
annoGenomeLabel(plot = mp, x = 0.5, y = 1.01)
annoYaxis(plot = mp, at = c(0, .5, 1), axisLine = TRUE, fontsize=8)
plotText(label = "XYZ", x = 0.15, y = .65, rot = 90, fontsize=8)
mp2 <- plotManhattan(dat, params = par, x = .5, y = 2, width = 3, height = .75, range=c(0, 1.1))
annoGenomeLabel(plot = mp2, x = 0.5, y = 2.01)
annoYaxis(plot = mp2, at = c(0, .5, 1), axisLine = TRUE, fontsize=8)
plotText(label = "XYZ", x = 0.15, y = 1.65, rot = 90, fontsize=8)
plotGenes(params = par, x = .5, y = 3.5, width = 3, height = 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment