Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Bug introduced in 10.0 and fixed in 10.2 or earlier


ListLinePlot generates the same legend for different lists of data when PlotMarkers and PlotStyle options are used:

list = {{{1, 2}, {2, 3}, {3, 4}}, {{2, 4}, {4, 6}, {6, 8}}};
ListLinePlot[list, PlotStyle -> Black, PlotMarkers -> {Automatic, 16}, 
PlotLegends -> {"A", "B"}]

enter image description here

Is this a bug?

I have Mathematica v10.0.0 installed on Windows 8 x64.

share|improve this question
up vote 5 down vote accepted

You just have to specify the LegendMarkers accordingly:

list = {{{1, 2}, {2, 3}, {3, 4}}, {{2, 4}, {4, 6}, {6, 8}}};
ListLinePlot[list, PlotStyle -> Black, PlotMarkers -> {Automatic, 16},
 PlotLegends -> PointLegend[{"A", "B"}, LegendMarkers -> {Automatic, 16}]]

Plot

share|improve this answer

This bug was fixed in Mathematica v10.3 or earlier.

$Version

$\ $"10.3.0 for Microsoft Windows (64-bit) (October 9, 2015)"

list = {{{1, 2}, {2, 3}, {3, 4}}, {{2, 4}, {4, 6}, {6, 8}}};
ListLinePlot[list, PlotStyle -> Black, PlotMarkers -> {Automatic, 16},
  PlotLegends -> {"A", "B"}]

fixedPlot

share|improve this answer
2  
I do observe this bug in version 10.0 on Windows but do not observe it in versions 10.2 and 9.0.1. So the bug is introduced in 10.0 and fixed in 10.2 or 10.1. I have changed the BUG header accordingly. – Alexey Popkov Oct 18 '15 at 8:17

Another possibility is that you define your own markers:

markers = {Graphics[{Black, Disk[]}], Graphics[{Black, Rectangle[]}]};

list = {{{1, 2}, {2, 3}, {3, 4}}, {{2, 4}, {4, 6}, {6, 8}}};

ListPlot[list,
 PlotLegends -> SwatchLegend[{"A", "B"},
   LegendMarkers -> markers,
   LegendLabel -> "Series",
   LegendFunction -> (Framed[#, RoundingRadius -> 5] &),
   LegendMargins -> 5],
 Joined -> True,
 PlotStyle -> Black,
 PlotMarkers -> Table[{size, 0.05}, {size, markers}]]

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.