Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Is there any way to change the thickness of line without changing the width?

For instance, the following example shows that as thickness increases, the white gap decreases. Is there any way to maintain the gap?

Show[
    ListPlot[{{0, 2}, {13.4, 2}}, PlotRange -> All, Joined -> True,
             Mesh -> None, PlotStyle -> {Gray, Thickness[0.01]}],
    ListPlot[{{14.7, 2}, {24, 2}}, Joined -> True, Mesh -> None,
             PlotStyle -> {Gray, Thickness[0.01]}]
]

thin lines with gap

Show[
    ListPlot[{{0, 2}, {13.4, 2}}, PlotRange -> All, Joined -> True,
             Mesh -> None, PlotStyle -> {Gray, Thickness[0.05]}],
    ListPlot[{{14.7, 2}, {24, 2}}, Joined -> True, Mesh -> None,
             PlotStyle -> {Gray, Thickness[0.05]}]
]

thick lines without gap

share|improve this question
    
Could you please edit your post (edit link below it) and use the {} button on the toolbar to format it for readability? –  Szabolcs Mar 15 '13 at 16:56
add comment

1 Answer 1

Use CapForm["Butt"] in PlotStyle to tell the system that the line must end exactly at the specified coordinates.

PlotStyle -> Directive[CapForm["Butt"], Gray, Thickness[0.05]]
share|improve this answer
    
Aha! This solved a problem of mine when I exported plots to pdf the thicker line went outside the frame slightly! Thanks! +1 –  s0rce Mar 15 '13 at 18:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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