# Plot with embedded legend and white space

It would be nice to be able to include a legend in a plot which has grid lines, but not have the grid lines included in the legend box. Here is an example with the legend containing those grid lines:

a[t_, \[Omega]_, \[Lambda]_] := Exp[-\[Lambda] t/5]; l =
ConstantArray[0, 5];
plot[q_, legend_, title_] :=
Plot[q, {t, 0, 1}, PlotLegends -> legend, Frame -> True,
GridLines -> Automatic, PlotRange -> {-0.025, 1.025},
FrameLabel -> {"t [seconds]", "F(t)", title},
LabelStyle -> Directive[14]]

l = Table[
Style[StringJoin["\[Lambda] = ", ToString[\[Lambda]]],
FontFamily -> "Apple Chancery", FontSlant -> Italic], {\[Lambda],
Range[5]}];
legend =
Placed[LineLegend[l, LegendFunction -> "Frame"], {.225, .35}];

plot[Table[
a[t, 1, \[Lambda]], {\[Lambda], Range[5]}], legend, "An example"]


LegendFunction -> (Framed[#, FrameMargins -> 0,

• +1 However, the Legend may be too prominent. I recommend (Framed[#, FrameMargins -> 0, RoundingRadius -> 4, Background -> White, FrameStyle -> Gray] &) May 4 at 1:10
• An important question that has raised to me myself: in the above figure how we can change the length of the lines in the legend. It is so important case when we have several Dashing styles, in our plots. Sometimes because of short length of lines in the legends we cannot distinguish different legends from each other. May 4 at 1:27
• @InzoBabaria - Add the option PlotTheme -> "Monochrome" to the Plot command. Are those lines long enough? May 4 at 1:39