If I understand you correctly, you can get what you want by using the little-known panel.first=
argument to plot.default()
:
plot(x,type="h",
panel.first = {
usr <- par('usr')
rect(c(1,7), usr[3], c(3,10), usr[4], col='green', border=NA)
})
Or, to avoid any mucking around with par('usr')
values, just do:
plot(x, type="h",
panel.first = rect(c(1,7), -1e6, c(3,10), 1e6, col='green', border=NA))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…