# Points are plotted twice in ListPlot

When I do a plot like this

ListPlot[
{Style[{1, 2}, Red],
Style[{2, 3}, Blue],
Style[{3, 4}, Green]}
]


under the colored points, there are duplicates with automatic Style. Indeed if you set Opacity differently than 1 you will the copy on the background

ListPlot[
{Style[{1, 2}, Red],
Style[{2, 3}, Blue, AbsolutePointSize[50], Opacity[0.5]],
Style[{3, 4}, Green]}
]


How to solve it? Thank you

• maybe lp=ListPlot[{Style[{1, 2}, Red, Opacity[.3], AbsolutePointSize[10]], Style[{2, 3}, Blue, Opacity[.3], AbsolutePointSize[10]], Style[{3, 4}, Green, Opacity[.3], AbsolutePointSize[10]]}] shows the issue more visibly. And, plt[[1]] clearly shows points are duplicated. Looks like a bug.
– kglr
Nov 20, 2023 at 16:35
• Actually, the issue is independent of Style wrapper. As ListPlot[{{{1, 2}}, {{2, 3}}, {{3, 4}, {4, 4}}, { {4, 5}, {5, 6}, {6, 7}}}][[1]] shows if a sublist contains a single point that point is repeated.
– kglr
Nov 20, 2023 at 16:42
• @kglr Easier to do Cases[Normal@plt, _Point, Infinity], if your plot is called plt, and the result is {Point[{{1., 2.}, {1., 2.}}], Point[{{2., 3.}, {2., 3.}}], Point[{{3., 4.}, {4., 4.}}], Point[{{4., 5.}, {5., 6.}, {6., 7.}}]}. Each of the single-point lists is repeated, whereas the multiple-point lists aren't. Weird. Nov 20, 2023 at 16:45
• weirder yet, check: ListPlot[{{{1, 2}}, Button[{2, 3}, Print[{2, 3}]], {{3, 4}, {3, 5}}, { {4, 5}, {5, 6}, {6, 7}}}][[1]]
– kglr
Nov 20, 2023 at 16:46
• @kglr Weird. I'm leaning towards classifying this as a bug, I think, but I'm not entirely sure: there could be some reason for this duplication of points in certain edge cases of ListPlot? It'd be nice if we could get some input from Mathematica employees. Nov 20, 2023 at 19:08

\$Version

(* "13.3.1 for Mac OS X ARM (64-bit) (July 24, 2023)" *)

Clear["Global*"]

data = {{1, 2}, {2, 3}, {3, 4}};

style = {Red, Directive[Opacity[0.2, Blue], AbsolutePointSize[50]], Green};


Make each data point a separate list.

ListPlot[List /@ data, PlotStyle -> style]


• This is definitely a kluge that fixes the issue, so +1, but the repeated points are still there: Cases[Normal@plt, _Point, Infinity] (where plt is the plot) yields {Point[{{1., 2.}, {1., 2.}}], Point[{{2., 3.}, {2., 3.}}], Point[{{3., 4.}, {3., 4.}}]}`. It works because it applies the same style to points in the same list, but the processing that goes on under the hood to create repeated points is still there and is weird. Nov 20, 2023 at 19:07