When I thought to vary PointSize
on a ListPlot
, I expected to find it trivial to do. I've likely overlooked something simple, but I've found it quite curious.
Reducing the problem to some simple examples:
ListPlot[{0.1, 0.2, 0.3}]
ListPlot[{0.1, 0.2, 0.3}, PlotStyle -> (PointSize[#] & /@ {Small, Medium, Large})]
ListPlot[{{0.1}, {0.2}, {0.3}}, PlotStyle -> (PointSize[#] & /@ {Small, Medium, Large})]
ListPlot[{{1, 0.1}, {2, 0.2}, {3, 0.3}}, PlotStyle -> (PointSize[#] & /@ {Small, Medium, Large}), PlotRange -> {{0, 3}, Automatic}]
The 1st plot shows the starting plot with no PlotStyle
set.
The 2nd plot shows an attempt to size the individual points. This does not work either, but the documentation for PlotStyle
explains why:
The 3rd plot makes each value in the original list its own object. This sizes the points properly, but does not plot them as I would like along the x axis.
The 4th plot adds position values for each object's point, but now I've lost the PointSizing.
Any suggestions on how to do this?
Any explanation of the paradigm involved in doing this properly?
Answer
Your forth input form is not three sets of points but rather one set in {x, y}
form. Adding an additional set of brackets gives the output you desire:
ListPlot[{{{1, 0.1}}, {{2, 0.2}}, {{3, 0.3}}},
PlotStyle -> (PointSize /@ {Small, Medium, Large}),
PlotRange -> {{0, 3.1}, Automatic}]
Comments
Post a Comment