Skip to main content
1 of 2
Alex
  • 345
  • 1
  • 12

How to border legends in ListLinePlot

I'm trying to use

ListLinePlot 

for 3 data sets, and I want to put borders for my legends. Here is my code:

series1 = {{3.8,0.}, {3.8,1.587}, {4.9,1.587}, {4.9,3.175}, {5.3,3.175}, {5.3,61.905}, {5.4,61.905}, {5.4,68.254}, {5.5,68.254}, {5.5,92.063}, {5.6,92.063}, {5.6,100.}, {9.1,100.}};
series2 = {{3.8,0.}, {5.7,0.}, {5.7,15.873}, {5.8,15.873}, {5.8,28.571}, {5.9,28.571}, {5.9,34.921}, {6.,34.921}, {6.,49.206}, {6.1,49.206}, {6.1,57.143}, {6.2,57.143}, {6.2,63.492}, {6.3,63.492}, {6.3,68.254}, {6.4,68.254}, {6.4,74.603}, {6.5,74.603}, {6.5,77.778}, {6.6,77.778}, {6.6,84.127}, {6.8,84.127}, {6.8,85.714}, {7.3,85.714}, {7.3,87.302}, {7.4,87.302}, {7.4,88.889}, {7.7,88.889}, {7.7,92.063}, {7.8,92.063}, {7.8,93.651}, {8.,93.651}, {8.,95.238}, {8.1,95.238}, {8.1,96.825}, {9.,96.825}, {9.,98.413}, {9.1,98.413}, {9.1,100.}};
series3 = {{6.5,0.}, {6.5,100}};

ListLinePlot[{series1,series2,series3},
PlotStyle -> {{Thickness[Large],GrayLevel[0]},{Dashing[{Small, Small}],GrayLevel[0]},{Dotted,Red}},
Frame -> True,
Joined -> True,
GridLines -> Automatic,
FrameLabel -> {"x", "y"},
PlotLegends -> {"series1", "series2"},
LegendBorder -> Black,
LabelStyle -> 
Directive[Bold, FontFamily -> "Times", FontSize -> 14, Frame -> True]

]

Unfortunately, the "LegendBorder" does not work and the Mathematica gives me this error:

ListLinePlot::optx: Unknown option LegendBorder-> in ListLinePlot[<<1>>].

Is there anyway to resolve this issue? Thanks.

Alex
  • 345
  • 1
  • 12