Reputation: 287
I want to make a figure similar to this
See how the bottom portion is tiny... how do I do that?
I'm ok in ggplots2 so give me your expertise please.
I do not need to plot 2 values on the larger one. Essentially, I know how to generate everything I want from this figure, except how to make a tiny plot under a larger one (sans photoshop)
I have data.frames that contain the transcript information in the figure at the bottom, I'm only interested in one gene. To plot the genes you would do something like this
plot(transcript, type="l", lwd=2)
points(exons, type="l", lwd=3, col="blue")
points(utrExons, type="l", lwd=3)
To plot the large figure it would look like this
plot(genetic.variant, pch=16)
An exhaustive internet search turned into bupkis, how do you make two figures in the same plotting area with one of them being much smaller than the other?
Upvotes: 0
Views: 1029
Reputation: 206242
With base graphics you can do something like this
dd<-data.frame(x=1:100, y1=runif(100), y2=cumsum(rnorm(100)))
layout(matrix(1:2, ncol=1), heights=c(3,1))
par(mar=c(0,3,3,2))
plot(y1~x,dd, xaxt="n", xlab="")
par(mar=c(3,3,0,2))
plot(y2~x,dd)
Upvotes: 1
Reputation: 8
You can use layout
layout(c(1,2),widths=c(5,1),heights=c(5,1),T)
par(mar=c(1,1,1,1)
and just change the heights depending on your preference
Upvotes: 0