Include the legend inside the plot but was failed

Space for the legend is available at the upper left

ListPlot[{
  {2, 5, 2, 8, 6, 8, 3},
  {1, 2, 5, 2, 3, 4, 3}},
 PlotMarkers -> {"✶", 15},
 Joined -> True,
 PlotStyle -> {Orange, Green},
 PlotLegends ->
  Placed[
   LineLegend[{"line1", "line2"},
    LegendFunction -> "Frame"],
   {.15, .8}],
 Frame -> True]

enter image description here

To locate legend at upper right you must change the PlotRange

ListPlot[{
  {2, 5, 2, 8, 6, 8, 3},
  {1, 2, 5, 2, 3, 4, 3}},
 PlotRange -> {{0, 9}, {0, 9}},
 PlotMarkers -> {"✶", 15},
 Joined -> True,
 PlotStyle -> {Orange, Green},
 PlotLegends ->
  Placed[
   LineLegend[{"line1", "line2"},
    LegendFunction -> "Frame"],
   {.85, .8}],
 Frame -> True]

enter image description here


You did not put any location for Placed

ListPlot[{{2, 5, 2, 8, 6, 8, 3}, {1, 2, 5, 2, 3, 4, 3}}, 
 PlotMarkers -> {"\[SixPointedStar]", 15}, Joined -> True, 
 PlotStyle -> {Orange, Green}, 
 PlotLegends -> Placed[LineLegend[{"line1", "line2"}, 
 LegendFunction -> (Framed[#, FrameMargins -> 0] &)], {0.1, 0.5}], 
Frame -> True]

enter image description here


Often these graphics commands are a bit obscure and one has to try. Is the following approx. what you are looking for?:

ListPlot[{{2, 5, 2, 8, 6, 8, 3}, {1, 2, 5, 2, 3, 4, 3}}, 
 PlotMarkers -> {"\[SixPointedStar]", 15}, Joined -> True, 
 PlotStyle -> {Orange, Green}, 
 PlotLegends -> 
  Placed[LineLegend[{"line1", "line2"}, 
    LegendFunction -> Framed], {0.85, 0.8}], Frame -> True, 
 PlotRange -> {{0, 10}, All}]