# pgfplots line cap fragments

On one specific set of data I get really strange fragments plotted in a 3D axis. The undesired fragments are "star-like" strokes, as can be seen in:

A mwe is:

\documentclass{standalone}
\usepackage{tikz,pgfplots}
\pgfplotsset{plot coordinates/math parser=false}
\begin{document}
\begin{tikzpicture}

\begin{axis}[%
width=5cm,
height=5cm,
xmin=-0.2,  xmax=0.2,
ymin=-0.1,  ymax=0.1,
zmin=0.52, zmax=0.58,
view={45}{50},
]

\addplot3 [color=black, solid, line width = 1.8pt, ]% draw opacity=0.25]
table[] {table.tsv};

\end{axis}
\end{tikzpicture}%
\end{document}


With a file table.tsv containing the data (50 pts here):

0.149696551896893   0.00951793396114361 0.525202161890948
0.149696532356039   0.00951421163718158 0.525202230010554
0.149696532356039   0.00951421163718158 0.525202230010554
0.149696532356039   0.00951421163718158 0.525202230010554
0.149695688789315   0.00951605042494391 0.525201935774821
0.149696532356039   0.00951421163718158 0.525202230010554
0.149696532356039   0.00951421163718158 0.525202230010554
0.149695688789315   0.00951605042494391 0.525201935774821
0.149695688789315   0.00951605042494391 0.525201935774821
0.149696551896893   0.00951793396114361 0.525202161890948
0.149695708334013   0.00951977273974269 0.525201867642248
0.149696551896893   0.00951793396114361 0.525202161890948
0.149696532356039   0.00951421163718158 0.525202230010554
0.149695688789315   0.00951605042494391 0.525201935774821
0.149697395461924   0.00951609517369444 0.525202456131739
0.149697395461924   0.00951609517369444 0.525202456131739
0.149697804598861   0.00951421197909466 0.525201442591703
0.149697395461924   0.00951609517369444 0.525202456131739
0.149696532356039   0.00951421163718158 0.525202230010554
0.149696532356039   0.00951421163718158 0.525202230010554
0.149696532356039   0.00951421163718158 0.525202230010554
0.149697824139503   0.00951793430318786 0.525201374472027
0.149697824139503   0.00951793430318786 0.525201374472027
0.149695708334013   0.00951977273974269 0.525201867642248
0.149696551896893   0.00951793396114361 0.525202161890948
0.149696551896893   0.00951793396114361 0.525202161890948
0.149697395461924   0.00951609517369444 0.525202456131739
0.149696532356039   0.00951421163718158 0.525202230010554
0.149697804598861   0.00951421197909466 0.525201442591703
0.149696532356039   0.00951421163718158 0.525202230010554
0.149697824139503   0.00951793430318786 0.525201374472027
0.149696551896893   0.00951793396114361 0.525202161890948
0.149696532356039   0.00951421163718158 0.525202230010554
0.149697395461924   0.00951609517369444 0.525202456131739
0.149698667702689   0.00951609551564581 0.525201668711887
0.149695708334013   0.00951977273974269 0.525201867642248
0.149696551896893   0.00951793396114361 0.525202161890948
0.149696551896893   0.00951793396114361 0.525202161890948
0.149696551896893   0.00951793396114361 0.525202161890948
0.149696551896893   0.00951793396114361 0.525202161890948
0.149696532356039   0.00951421163718158 0.525202230010554
0.149697824139503   0.00951793430318786 0.525201374472027
0.149696551896893   0.00951793396114361 0.525202161890948
0.149696551896893   0.00951793396114361 0.525202161890948
0.149695708334013   0.00951977273974269 0.525201867642248
0.149696551896893   0.00951793396114361 0.525202161890948
0.149696551896893   0.00951793396114361 0.525202161890948
0.149697395461924   0.00951609517369444 0.525202456131739
0.149697395461924   0.00951609517369444 0.525202456131739
0.149696532356039   0.00951421163718158 0.525202230010554


Is there something wrong with the data? Like too high precision or too close sampling or something? I don't really have a clue why only this data produces these fragments. When plotting the whole curve with 2000pts they appear at the start and end of the plotted line.

All these points lie very close to each other: the x coordinate only varies from the 6th decimal place, the z and the y in the 5th. You are drawing lots of straight lines between points essentially on top of each other, but forcing the line width to be quite large (1.8pt), so you get a collection of wide bars printed essentially on top of each other at various angles determined by the data. Reducing the line width will make the problem less visible, see below, but perhaps you just want fewer sample points and / or to normalise the data to a particular accuracy.

\documentclass{standalone}
\usepackage{tikz,pgfplots}
\pgfplotsset{plot coordinates/math parser=false}
\begin{document}
\begin{tikzpicture}

\begin{axis}[%
width=5cm,
height=5cm,
xmin=-0.2,  xmax=0.2,
ymin=-0.1,  ymax=0.1,
zmin=0.52, zmax=0.58,
view={45}{50},
]

\addplot3 [color=black, solid, line width = .1pt, ]% draw opacity=0.25]
table[] {table.tsv};

\end{axis}
\end{tikzpicture}%
\end{document}

• I thought about exactly that, but stangely enought different pdf-capable programs display the situation differently. Since this is a simulation, and the system starts slow and stops at the end, it is somewhat clearer now, why these things happen at the start-/end point. Thanks
– mike
Dec 11, 2015 at 15:40
• Yeah, since the rate of change is highest in the middle of the dataset, the described effect occured at the most oversampled regions. Deleting in-between points specifically there did the trick. Thanks for the fast and clear answer.
– mike
Dec 11, 2015 at 15:46