Unexpected dots from Line
Possible workaround (tested on V9.0.1, Linux): just add VertexColors -> {Black}
option.
Without this option I get
repeatPts[pt_, n_] := Line[ConstantArray[pt, n]]
Graphics[{Thickness[.125], CapForm[cap], repeatPts[{0., 0.}, #],
repeatPts[{1., 1.}, #]}, ImageSize -> 50, Frame -> True,
FrameTicks -> None, PlotRangePadding -> .3] & /@
Range[5] /. {{cap -> "Round"}, {cap -> "Square"}, {cap -> "Butt"}} // Grid
This behavior is completely unexpected: why 3 or more points differs from 1 and 2? Why in the first row the size of the points is quite different? Why we see something in the third row? (CapForm["Butt"]
is the absence of the cap).
With VertexColors -> {Black}
the result is much better:
repeatPts[pt_, n_] := Line[ConstantArray[pt, n], VertexColors -> {Black}]
Graphics[{Thickness[.125], CapForm[cap], repeatPts[{0., 0.}, #],
repeatPts[{1., 1.}, #]}, ImageSize -> 50, Frame -> True,
FrameTicks -> None, PlotRangePadding -> .3] & /@
Range[5] /. {{cap -> "Round"}, {cap -> "Square"}, {cap -> "Butt"}} // Grid
Now everything is clean: there is no line with 1 point (the first column). In the other cases this point is the cap of the line with zero length.
I brought this to the attention of the WRI tech support. This was their reply:
I am writing to let you know that I have reported this bad behavior to our development team. I would also like to point out (if you were not aware) that the behavior you observed is even different between operating systems (for example, in Linux the points always appear, but when more than three points are present the "point" is a square).
I conclude from this that WRI will investigate this problem as a bug, and perhaps fix it in a future release.
Inspired by george2079's answer:
line[arg__] := Line[arg];
line[{x_ ..}, ___] := {};