In vanilla plotting, it is possible to use a polygon
call in the panel.first
argument to plot
to highlight a background region. Is it possible to do the same in ggplot2
? Can it be done while preserving the gridlines?
eg:
# plot hp and wt for mtcars data, highlighting region where hp/wt ratio < 35
with(mtcars,plot(hp,wt,
panel.first=polygon(c(0,0,max(wt)*35),c(0,max(wt),max(wt)),
col="#d8161688",border=NA)))