Skip to main content
minor edit
Source Link
Syed
  • 59.4k
  • 5
  • 40
  • 95
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}
 ]
p2 = ListLinePlot[{{{0, 0}, {1, 1}}, {{0, 0}, {1, .8}}}
  , Epilog -> 
   Inset[LineLegend[{ColorData[97][1], ColorData[97][2]}, {"1", 
      "2"}], {.8, .4}]
  ]

Head[%]

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}
 ]
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}
 ]
added explanation for Inset usage
Source Link
Syed
  • 59.4k
  • 5
  • 40
  • 95
p2 = ListLinePlot[{{{0, 0}, {1, 1}}, {{0, 0}, {1, .8}}}
  , Epilog -> 
   Inset[LineLegend[{ColorData[97][1], ColorData[97][2]}, {"1", 
      "2"}], {.8, .4}]
  ]

Head[%]

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[
Image[p2] 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}
 ]
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]
p2 = ListLinePlot[{{{0, 0}, {1, 1}}, {{0, 0}, {1, .8}}}
  , Epilog -> 
   Inset[LineLegend[{ColorData[97][1], ColorData[97][2]}, {"1", 
      "2"}], {.8, .4}]
  ]

Head[%]

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}
 ]
Source Link
Syed
  • 59.4k
  • 5
  • 40
  • 95

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]