I have a series of `pgfplots`-based figures that I compile to pdf images using the `standalone` package. I currently have one .tex-file per figure. The problem with this is that since it might just be the data file that changes between the .tex-files, this potentially involves a lot of copied code. Consider the following example:

```
\documentclass{standalone}
\usepackage{tikz, pgfplots}

\begin{document}
\begin{tikzpicture}

\begin{axis}[
xlabel=$x$,
ylabel=$y$]

\addplot[color=black]
table[x=x, y=y] {table1.txt};
%table[x=x, y=y] {table2.txt};
%table[x=x, y=y] {table3.txt};

\end{axis}

\end{tikzpicture}
\end{document}

```

The above includes my current solution to the problem stated above: I simply uncomment the appropriate row depending on which .txt-file I want to import, and repeat and recompile until all the pdf files have been generated.

Is there a more elegant way of achieving this, preferably automated (so that a bunch of different pdf files are compiled at once)? The closest I've come to a solution is the `multi`-functionality in `standalone`, allowing multiple-page outputs. But I'd prefer output in the form of multiple pdf-images.