9
$\begingroup$

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.

$\endgroup$
5
$\begingroup$

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

$\endgroup$
3
$\begingroup$

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

$\endgroup$
  • 2
    $\begingroup$ 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. $\endgroup$ – Alexey Popkov Oct 18 '15 at 8:17
1
$\begingroup$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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