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.
1 Answer
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
-
How the tex/pgfplots will identify if I modify the plots environment? Should I manually delete the pdf file created in the earlier runs?– sureshCommented Apr 4, 2012 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. Commented Apr 4, 2012 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?– sureshCommented Apr 4, 2012 at 0:53
-
2There 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? Commented Apr 4, 2012 at 1:14 -
1You can use
\tikzset{external/force remake}
to remake all followingtikzpicture
s, or\tikzset{external/remake next}
to only remake the nexttikzpicture
.– JakeCommented Apr 4, 2012 at 6:53
32 Externalization Library
of the tikz/pgf manual. Basically\usetikzlibrary{external} \tikzexternalize
should be all you need.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?\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.