覆盖R中没有轴标题的绘图(没有ggplot2)

覆盖R中没有轴标题的绘图(没有ggplot2),r,R,我在论坛的任何地方都找不到我问题的答案。我现在有两个情节,其中一个是另一个情节的放大。例如,我有以下几点: attach(mtcars) plot(wt, mpg, main="Scatterplot Example", xlab="Car Weight ", ylab="Miles Per Gallon ", pch=19) plot(wt, mpg, main="Scatterplot Example", xlab="Car Weight ", ylab="

我在论坛的任何地方都找不到我问题的答案。我现在有两个情节,其中一个是另一个情节的放大。例如,我有以下几点:

    attach(mtcars)
plot(wt, mpg, main="Scatterplot Example", 
     xlab="Car Weight ", ylab="Miles Per Gallon ", pch=19)

plot(wt, mpg, main="Scatterplot Example", 
     xlab="Car Weight ", ylab="Miles Per Gallon ", pch=19, xlim=c(0, 3) )
我试图覆盖这张图片所描绘的第二个情节(xlim位于情节的右上角)

起初,我尝试将情节分配到一个字符中,并使用下面的代码,但是这不起作用

vp <- viewport(x=0.78,y=0.75,width=0.35, height=0.338)

full <- function() {
  print(g1)
  theme_set(theme_bw(base_size = 8))
  print(subplot2, vp = vp)
}

full()
vp你可以像这样使用
par(图=c(0.5,1,0.5,1),new=TRUE)
选项内的数字为x0、x1、y0、y1,代表绘图的百分比。在这种情况下,图形在x轴的50%处开始(x0),在原始轴的100%处结束(x1)

plot(wt, mpg, main="Scatterplot Example", 
     xlab="Car Weight ", ylab="Miles Per Gallon ", pch=19)
par(fig=c(0.5,1,0.5,1), new=TRUE)
plot(wt, mpg, main="", 
     xlab="Car Weight ", ylab="Miles Per Gallon ", pch=19, xlim=c(0, 3) )

问题是什么?我似乎无法将这两个情节重叠起来。有什么建议吗?非常感谢!