# Is it possible to specify a zero-thickness curve for a (filled) ListPlot?

With Joined -> True, ListPlot's filling is solid by default. But note that the filling and the line have different shades:

ListPlot[
Table[{x, Sin[x Pi]}, {x, 0, 1, 0.025}]
, Filling -> Axis
, Joined -> True
, ImageSize -> Small
]


AFAICT, one cannot get a curve with zero thickness:

ListPlot[
Table[{x, Sin[x Pi]}, {x, 0, 1, 0.025}]
, Filling -> Axis
, Joined -> True
, PlotStyle -> Thickness[0]
, ImageSize -> Small
]


Is that really true?

PS: yes, I know that I can muck with the curve's color and/or opacity to simulate a zero-thickness curve in this case. E.g.

ListPlot[
Table[{x, Sin[x Pi]}, {x, 0, 1, 0.025}]
, Filling -> Axis
, Joined -> True
, PlotStyle -> Opacity[0]
, ImageSize -> Small
]


But I just want to confirm that, indeed, Mathematica won't let you have a zero-thickness curve.

• (you can also use PlotStyle -> None) Mar 4, 2017 at 23:19
• A zero thickness curve would be invisible -- Maybe it does draw one. :) Mar 5, 2017 at 4:17
• Mar 8, 2017 at 3:06
• @AlexeyPopkov That's the one I was looking for but I only found (9189); thanks for linking it! Mar 8, 2017 at 5:49

No, you cannot draw a sub-pixel-width line, at least in Mathematcia 10 under Windows:

SeedRandom[4];
pts = RandomReal[1, {10, 2}];
Graphics[{AbsoluteThickness[0], Line @ pts}]
Graphics[{Thickness[0.000001], Line @ pts}]


As noted in other questions like How can the opacity of a dense data set be automatically chosen? the solution is to use an Opacity less than one, or PlotStyle -> None, even though this displeases you.

• A zero-width line is not sillier than a zero-opacity line. They both produce the same visual effect. I think something is lost when the semantics of Thickness[0] are special-cased like this. There's something to be said for uniformity of interface. And I disagree with your answer's first sentence: one can draw a zero-pixel line, vacuously.
– kjo
Mar 5, 2017 at 10:47
• @kjo (1) I never said a zero-width line was silly. Sub-pixel-width lines are possible in other software; it seems entirely plausible that they would be supported in Mathematica. (2) If however they both produce the same visual effect then using opacity is a working solution, or work-around, which is all I can offer. (3) I agree, Thickness[0] or perhaps even worse AbsoluteThickness[0] producing a 1-pixel-width line doesn't make sense. (4) I did write sub-pixel-width rather than zero-width for a reason. Mar 5, 2017 at 18:42
– kjo
Mar 6, 2017 at 13:47

It turns out you can, in fact, get a line with zero thickness. You can do this by passing a negative thickness as an argument to Thickness.

For instance, in your code example,

ListPlot[Table[{x, Sin[x Pi]}, {x, 0, 1, 0.025}], Filling -> Axis,
Joined -> True, PlotStyle -> Thickness[-2], ImageSize -> Small]


Produces

This workaround does seen to have issues in other places, such as exporting the file, where it seems the magnitude of the thickness is used to produce the saved graphic.

• This is new to me! Thanks for posting. :-) Mar 8, 2017 at 1:23
• (+1) This works when Exporting to PDF, but not to EMF or PNG. Mar 8, 2017 at 3:04