3.9 Plotting Many Datafiles at Once

The wildcards * and ? may be used in filenames supplied to the plot command to plot many datafiles at once. The following, for example, would plot all datafiles in the current directory with a .dat suffix, using the same plot options:

plot '*.dat' with linewidth 2

In the graph’s legend, full filenames are displayed, allowing the datafiles to be distinguished.

If a blank filename is supplied to the plot command, the last used datafile is used again, as in the example:

plot 'data.dat' using 1:2, '' using 2:3

This can even be used with wildcards, as in the following example:

plot '*.dat' using 1:2, '' using 2:3