TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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 am writing a report containing multiple plots of spectroscopic data by way of PGFplots which is fetching data from external files. It used to do the work, and after a few minutes of compilation it would render a pdf, but as I added more results to be plotted it slowed down and now it does not appear to ever finish. (I have waited for about an hour now)

The code I use is pretty much a repeat of this for thirteen different csv files, ranging between two columns and ten.

\begin{axis}[xlabel near ticks,axis background/.style={
   ymin=0,enlargelimits=false,ylabel=Counts,no marks,grid,cycle list name=color list]
  \addplot table[x index=1,y index=2,col sep=space,row sep=crcr] {spectroscopy_data.csv};
  \addplot table[x index=1,y index=3,col sep=space,row sep=crcr] {spectroscopy_data.csv};
share|improve this question
does it compile if you comment out the first plots and only compile the last few? – long tom Apr 9 '13 at 18:02
my typical experience is that it is extremely much faster (if you have many columns) to have every dataplot in a two column setup (yes, more files). This should give you some speedup. Or else you could read in the full data set (see the pgfplotstable manual for this) and this should yield a very nice speedup as well. – zeroth Apr 9 '13 at 18:04
long tom: Yes. It does. I got it working by enabling tikz external as suggested by ExP. Even with the external library enabled running a first time compile on my ultrabook is a borderline hopeless task unless first compiled on my stationary i7. Thankfully the problem is solved now! zeroth: That does seem to help! Thank you very much :) – Mr. V Apr 11 '13 at 6:45
up vote 4 down vote accepted

For plots of large data-files, I recommend the TikZ-library external. It allows to compile your plots separately from your main document. This way, your main document will be typeset within seconds, while you can compile the plots one by one (if desired even in parallel).

share|improve this answer
Welcome to TeX.sx! – Peter Jansson Apr 9 '13 at 18:42
Thanks! That does appear to solve the problem. It should be added that I had no success with it until I enabled --shell-escape. Or, on Windows -enable-write18 – Mr. V Apr 11 '13 at 6:42

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.