在传统绘图中,可以在
例如:
plot
函数的panel.first
参数中使用polygon
函数来突出显示背景区域。在ggplot2
中是否也可以这样做?能否在保留网格线的同时完成这个功能?例如:
# 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)))
geom_polygon
中使用alpha
美学。 - rcs