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.
Asked
Active
Viewed 1,824 times
7
1 Answers
5
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
Peter Grill
- 223,288
-
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 04 '12 at 00: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 04 '12 at 00: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 04 '12 at 00:53
-
I meant use something like the
standalonepackage so that they are fully compilable by themselves. That way when the file containing the figure changes, the external figure needs to be generated. If this is not automatically working with the externalization library it is easy to automate viamakeorlatexmk. – Peter Grill Apr 04 '12 at 00:57 -
You know I was using gnuplot earlier and recently migrated to tikz and I was finding it nice. But how to do such a thing without using another graphing program? I mean by using tikz or its related packages alone? – suresh Apr 04 '12 at 01:01
-
I am not sure what you mean. It seems like that desrves a separate question. – Peter Grill Apr 04 '12 at 01:03
-
Oh
standaloneis a latex package. I guess I understood what you meant. I searched forstandalonein pgf manual and couldnot understand that. Thanks – suresh Apr 04 '12 at 01:10 -
2There are many references to the
standalonepacakge on this site. For instance see How can I generate just pgf/TikZ images, not placed a whole page or slide? – Peter Grill Apr 04 '12 at 01:14 -
1You can use
\tikzset{external/force remake}to remake all followingtikzpictures, or\tikzset{external/remake next}to only remake the nexttikzpicture. – Jake Apr 04 '12 at 06:53
32 Externalization Libraryof the tikz/pgf manual. Basically\usetikzlibrary{external} \tikzexternalizeshould be all you need. – Peter Grill Apr 03 '12 at 23:56system 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 04 '12 at 00:20\documentclassand 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-write18and ensure that you do not have older .aux files lying around. – Peter Grill Apr 04 '12 at 00:24