Take the 2-minute tour ×
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.

I saw Why is tikz so much slower when plotting a huge amount of data than WYSIWYG plotting tools? that pgfplots can be configured to do the plotting only once. How to do this? I have a document with many graphs and repeated runs takes so much time.

share|improve this question
1  
See Section 32 Externalization Library of the tikz/pgf manual. Basically \usetikzlibrary{external} \tikzexternalize should be all you need. –  Peter Grill Apr 3 '12 at 23:56
    
Thanks for the reply. It does work. But I have a small problem. Every time I run pdflatex, it stops in between saying that the system call 'pdflatex -shell-escape -halt-on-error -interaction=batchmode -jobname "pami2012-figure2" "\def\tikzexternalrealjob{pami2012}\input{pami2012}"' did NOT result in a usable output file 'pami2012-figure2' (expected one of .pdf:.jpg:.jpeg:.png:). Please verify that you have enabled system calls. Actually I have enabled write18 and the pdf of each of the figures are produced also. I manage by pressing 's', but how to avoid that? –  suresh Apr 4 '12 at 0:20
1  
It would be helpful if you would compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages. This will also serve as a test case and ensure that the solution actually works for you. In the mean time, perhaps try adding -enable-write18 and ensure that you do not have older .aux files lying around. –  Peter Grill Apr 4 '12 at 0:24
    
It is fine now. There was another error (file missing) which caused this behavior I guess. But that error did not show up instead the previous one (the one I posted earlier) showed up. Thanks again. It is difficult to imagine when one quickly thumbs through the pgf manual that it is the externalization library that is needed. –  suresh Apr 4 '12 at 0:28
add comment

1 Answer

up vote 5 down vote accepted

The details of this are described in Section 32 Externalization Library of the tikz/pgf manual.

Basically adding the following to your preamble should be all that is needed:

\usetikzlibrary{external} 
\tikzexternalize
share|improve this answer
    
How the tex/pgfplots will identify if I modify the plots environment? Should I manually delete the pdf file created in the earlier runs? –  suresh Apr 4 '12 at 0:34
    
That is one reason why it is better to keep the figures in external files and include them in your main document. Deleting the externally generated figures will should work. You could also try \tikzset{external/force remake}, which is not something I have used. –  Peter Grill Apr 4 '12 at 0:44
    
I deleted the pdf files tex created and it did work. What do you mean by "keep the figures in external files"? Another latex file with tikzpicture environment and include that? But then how will that help this situation? –  suresh Apr 4 '12 at 0:53
1  
There are many references to the standalone pacakge on this site. For instance see How can I generate just pgf/TikZ images, not placed a whole page or slide? –  Peter Grill Apr 4 '12 at 1:14
1  
You can use \tikzset{external/force remake} to remake all following tikzpictures, or \tikzset{external/remake next} to only remake the next tikzpicture. –  Jake Apr 4 '12 at 6:53
show 5 more comments

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.