4

I am trying to create a ListPlot where the size of each marker is controlled individually.

The best solution I have found so far is to wrap every data point in Style with its own PointSize value, as suggested here

ListPlot[Table[Style[RandomReal[{-2, 2}, 2], PointSize[RandomReal[{0, 0.03}]]], {i, 100}]]

enter image description here

However, this type of scaling does not allow reducing the size to zero, but keeps the marker size constant at some point:

ListPlot[Table[Style[{i, 2}, PointSize[0.08 - 0.002*i]], {i, 50}]

enter image description here

How can I ensure that the scaling of the markers is really linear with respect to Pointsize all the way to zero?

Hausdorff
  • 3,505
  • 1
  • 9
  • 25

1 Answers1

6

This is certainly suboptimal behavior, if not a bug. You can workaround the issue by using PlotStyle->None and including Opacity[1] in your style:

ListPlot[
    Table[Style[RandomReal[{-2,2},2],Opacity[1],PointSize[RandomReal[{0,0.03}]]],{i,100}],
    PlotStyle->None
]

enter image description here

And, your second example:

ListPlot[
    Table[Style[{i,2},Opacity[1],PointSize[0.08-0.002*i]],{i,50}],
    PlotStyle->None
]

enter image description here

Carl Woll
  • 130,679
  • 6
  • 243
  • 355