barplot()只是 的包装器rect(),因此您可以自己添加条形图。这可能是一个开始:
x <- sort(sample(1:100, 10, replace=FALSE)) # x-coordinates
y <- log(x) # y-coordinates
yD <- c(0, 2*diff(y)) # twice the change between steps
barW <- 1 # width of bars
plot(x, y, ylim=c(0, log(100)), pch=16)
rect(xleft=x-barW, ybottom=0, xright=x+barW, ytop=yD, col=gray(0.5))

您的第二个想法可以通过将设备区域拆分为par(fig).
par(fig=c(0, 1, 0.30, 1)) # upper device region
plot(x, y, ylim=c(0, log(100)), pch=16)
par(fig=c(0, 1, 0, 0.45), bty="n", new=TRUE) # lower device region
plot(x, y, type="n", ylim=c(0, max(yD))) # empty plot to get correct axes
rect(xleft=x-barW, ybottom=0, xright=x+barW, ytop=yD, col=gray(0.5))
