I am trying to generate manhattan plots for a GWAS I performing. I have the chromosome position and score. I can make 5 individual plots with the position on each chromosome as the x axis and the p-score on the y axis. I want to plot these on the same graph side by side so that there is only one y axis, and then the chromosomes are shown in order (1-5). Does anyone have any ideas?
Asked
Active
Viewed 422 times
0
-
Please read [this](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610#5963610) about asking questions in a way we readily can help you. There is not enough information in your question to answer effectively. – Bryan Hanson Apr 09 '15 at 00:32
-
For plots, it would be useful if you had an example or mockup of what you want, along with what you have so far. – Molx Apr 09 '15 at 02:03
1 Answers
0
Are you using a package specific plotting method, and is there any reason you don't just concatenate the data into one object to produce a single plot?
In general, you could specify the layout as par(mfrow=c(1,5)) to give a 1x5 figure, and then suppress the axes for each call to plot. After the first plot call, you can use the axis() function to set the x and y axes, and then for the rest of the plots, only set the x axis. Add text to the outer margins as necessary.
par(mfrow=c(1,5))
par(mar=c(5.1,1.1,4.1,1.1),oma=c(0,4,2,0))
for (i in 1:5) {
if (i == 1) {
plot(rnorm(n=100,0.05,0.01),axes=FALSE,type="h",
ylab="",xlab=paste("Chromosome ",i,sep=""))
axis(side=1)
axis(side=2)
} else if (i != 5) {
plot(rnorm(n=100,0.05,0.01),axes=FALSE,type="h",
ylab="",xlab=paste("Chromosome ",i,sep=""))
axis(side=1,ylab=FALSE)
} else {
plot(rnorm(n=100,0.05,0.01),axes=FALSE,type="h",
ylab="",xlab=paste("Chromosome ",i,sep=""))
axis(side=1,ylab=FALSE)
}
}
mtext("P-Scores",side=2,line=2,outer=TRUE)
mtext("P Scores Along Chromosomes 1 through 5",side=3,outer=TRUE)

ajkal
- 3
- 1