You can use the Prolog
option with Scaled
coordinates:
Plot[Sin[x], {x, 0, 2 \[Pi]π}, Frame -> True,
Prolog -> {LightGray, Rectangle[Scaled[{0, 0}], Scaled[{1, 1}]]}
]
Note: Using scaled coordinates lets this work for any PlotRangePadding
, and with PlotRangePadding->False
:
Plot[Sin[x], {x, 0, 2 \[Pi]π}, Frame -> True,
Prolog -> {LightGray, Rectangle[Scaled[{0, 0}], Scaled[{1, 1}]]},
PlotRangePadding -> .6]
Plot[Sin[x], {x, 0, 2 \[Pi]π}, Frame -> True,
Prolog -> {LightGray, Rectangle[Scaled[{0, 0}], Scaled[{1, 1}]]},
PlotRangePadding -> -.2, PlotRangeClipping -> False]