TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a problem concerning pgfplots and large datasets. I have the following minimal example:


\pgfplotsset{plot coordinates/math parser=false}


%\tikzset{external/system call={lualatex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"}}
\tikzset{external/remake next}

\tikzset{external/remake next}

\tikzset{external/remake next}


The three files lwXX.tikz can be found here (also the .tex-file and the result).

Since I know there are problems concerning the memory in LaTeX, I use the externalization option and the parameter -buf-size=5000000 while compiling the file (I also tried to compile the figures using LuaLaTeX which can be done by uncommenting the comment, but the output did not change)

My problem now is, there are unwanted spikes in the output. I illustrated it in a picture, which can be seen here


The three figures are plotted using different line widths in the TikZ file. If you zoom in in the .pdf-file you will see what I mean. Also in the second pictures some spikes will then appear.

Does anybody know, where these errors come from and how to avoid them? I can hardly reduce the size of the dataset, since the underlying data is a sinusoidal function multiplied with some other function and one period of the sinusoidal is already only made up of approximately 14 datapoints. I don't want to reduce this number any further.

share|improve this question
When I run diff on the three tikz files, the differences between the files are only in the values of the line width parameters. Is this as it should be? – A.Ellett Jun 12 '13 at 17:19
Originally I had even bigger files, where I definitely needed to increase the buffer. But I tried it again and you are right, for this example I actually do not need to increase it. and for the different files, I intentionally only changed the line width (what I already wrote under the figure) to illustrate the different outcome. – bene Jun 12 '13 at 17:29
up vote 7 down vote accepted

This problem appears because the corners on the lines are really tight, causing the lines to overshoot when a sharp line join is used (see How can I prevent pgfplots from rendering lines incorrectly when I use "no markers"?). You can fix this by using line join=round. to apply that option to all your plots without having to change all the files, you can simply add the following to your document:

    every axis plot post/.style={
        line join=round

share|improve this answer

Your Answer


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.