While Eli's answer is elegantly simple, it has a drawback: the Prolog
objects are layered on top of GridLines
, thus a background rectangle covers all the gridlines. So to come over this issue, here is my version of a background-and-frame.
The general background (gray) is defined by the outermost Frame
's Background
option (this way we won't cover GridLines
), while the outer green frame is defined as a FilledCurve
(using ImageScaled
and Scaled
coordinates), put in an independent Graphics
object, and displayed with the final plot via Show
. There is at least one caveat: any options defined for a Plot
object must be then forwarded to the Show
, otherwise they mess up the result.
Framed[
Show[
Graphics[{
Hue[.3, 1, 1, .5],
FilledCurve[{
{Line[ImageScaled /@ {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]},
{Line[Scaled /@ ({{0, 0}, {1, 0}, {1, 1}, {0, 1}})]}
}],
}],
Plot[Sin[x], {x, 0, 2 \[Pi]}], (* this is the main plot, options given to Show *)
ImagePadding -> 30, Frame -> True, GridLines -> Automatic,
GridLinesStyle -> Red
],
Background -> GrayLevel@.9, FrameMargins -> 0, FrameStyle -> None]

You might wonder why I didn't put the FilledCurve
into the Plot
's Prolog
: well, Prolog
cannot handle coordinates that are out of the defined PlotRange
, thus ImageScaled
coordinates out of the plot's frame won't show at all.