R 绘制两张图;一大一小

R 绘制两张图;一大一小,r,R,看看底部有多小。。。我该怎么做 我在ggplots2中很好,所以请告诉我你的专业知识 我不需要在较大的值上绘制2个值。基本上,我知道如何从这个图中生成我想要的一切,除了如何在一个较大的图下绘制一个小图(无photoshop) 我有数据框,包含底部图中的转录本信息,我只对一个基因感兴趣。要绘制基因图,你可以这样做 plot(transcript, type="l", lwd=2) points(exons, type="l", lwd=3, col="blue") points(utrExons,

看看底部有多小。。。我该怎么做

我在ggplots2中很好,所以请告诉我你的专业知识

我不需要在较大的值上绘制2个值。基本上,我知道如何从这个图中生成我想要的一切,除了如何在一个较大的图下绘制一个小图(无photoshop)

我有数据框,包含底部图中的转录本信息,我只对一个基因感兴趣。要绘制基因图,你可以这样做

plot(transcript, type="l", lwd=2)
points(exons, type="l", lwd=3, col="blue")
points(utrExons, type="l", lwd=3)
plot(genetic.variant, pch=16)
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)
要绘制一个大的数字,它应该是这样的

plot(transcript, type="l", lwd=2)
points(exons, type="l", lwd=3, col="blue")
points(utrExons, type="l", lwd=3)
plot(genetic.variant, pch=16)
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)
一个详尽的互联网搜索变成了bupkis,你如何在同一个绘图区域中绘制两个图形,其中一个比另一个小得多

您可以使用布局

layout(c(1,2),widths=c(5,1),heights=c(5,1),T)
par(mar=c(1,1,1,1)

只需根据您的喜好更改高度即可

使用基本图形,您可以执行以下操作

plot(transcript, type="l", lwd=2)
points(exons, type="l", lwd=3, col="blue")
points(utrExons, type="l", lwd=3)
plot(genetic.variant, pch=16)
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)

ddi如果你把你已经掌握的代码添加到你的Q中,那么你可能会从潜在的回答者那里获得更多的兴趣。这里的问题通常会引起人们的注意。谢谢,这帮了大忙