p2 = ListLinePlot[{{{0, 0}, {1, 1}}, {{0, 0}, {1, .8}}}
, Epilog ->
Inset[LineLegend[{ColorData[97][1], ColorData[97][2]}, {"1",
"2"}], {.8, .4}]
]
Head[%]
Image[p2]
EDIT-1 From the docs: Inset[obj,pos]
is one of the available syntax. In response to the OP's comment, a manipulate is being added to show usage. As soon as Placed
is used, the Head
changes to Legended
.
Manipulate[
p3 = ListLinePlot[{
{{0, 0}, {1, 1}}
, {{0, 0}, {1, .8}}
}
, ImagePadding -> {{10, 10}, {10, 10}}
, Epilog -> Inset[LineLegend[
{ColorData[97][1]
, ColorData[97][2]}
, {"1", "2"}], {i, j}
]
],
{{i, 0.5, "x", Appearance -> Labeled}, 0.1, 1.0}
, {{j, 0.5, "y", Appearance -> Labeled}, 0.1, 1.0}
]
Image@Rasterize@plot
$\endgroup$Rasterize[plot, "Image"]
$\endgroup$