5
$\begingroup$

If one plots a filled line plot such as, for example, the one produced by

ListLinePlot[{{{0, 0.6}, {0.5, 0.6}}, {{0.5, 0.3}, {1, 0.3}}}, 
    Filling -> Axis, PlotStyle -> AbsoluteThickness[10],
    AspectRatio -> Automatic, PlotRange -> {Automatic, {0, 0.8}},
    PlotRangePadding -> None]

the ends of the plot's lines have a rather noticeable "overhangs" beyond the fill regions below. How can I make this line be flush with the fill?

$\endgroup$
0
7
$\begingroup$

What you're seeing are the ends of the lines or the "caps" and because of the high thickness that you've specified, its presence is obvious. The solution here is to add CapForm -> None to the PlotStyle, which should give you the following plot.

The following example shows the effect of the caps more clearly:

With[{caps = {None, "Butt", "Round", "Square"}}, 
    Graphics[
        {
            {Opacity[0.3], CapForm[#], AbsoluteThickness[10], Line[{{0, 0}, {1, 0}}]},      
            {Red, Point[{{0, 0}, {1, 0}}]}
        }, 
        Axes -> {True, False}, AspectRatio -> 1/10, PlotRange -> {{-0.1, 1.1}, Automatic}, 
        ImageSize -> 300, PlotLabel -> ToString@#
    ] & /@ caps
] // Column

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.