[Tex/LaTex] Tikz external files and pdf

graphicsMATLABpdftexpgfplotstikz-pgf

I plot graph in my article with the command '\begin{tikzpicture} ..\end{tikzpicture}'. First, I extract datas from matlab in a text file and I use \addplot with all the options. It is great, but my compilation is very very long ( I have a lot of figures ). Is it possible to have all the figures in tikz external files ( which I can modify sometimes ) and convert into a pdf file (because using \includegraphics with a pdf file is very fast) ?

Best Answer

You can process your tikzpictures as standalone documents and then include them as pictures. E.g., the file myplot.tex might contain

\documentclass[border=0.1cm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
  \begin{axis}[...]
  ...
  \end{axis}
\end{tikzpicture}
\end{document}

Your main document then includes the generated pdfs:

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics{myplot.pdf}
\end{document}