I have 6 files which need to be plotted as line graphs with error margins and output them to different png files. The file format is as follows.seconds mean-average min maxHow would I go about plotting these graphs automatically? So I run a file called bash.sh and it will get the 6 files and output the graphs to different .png files. Titles and axis labels are also required.
automate gnuplot plotting with bash
shell script;gnuplot
If I understand correctly, this is what you want:for FILE in *; do    gnuplot <<- EOF        set xlabel Label        set ylabel Label2        set title Graph title           set term png        set output ${FILE}.png        plot ${FILE} using 1:2:3:4 with errorbarsEOFdoneThis assumes your files are all in the current directory. The above is a bash script that will generate your graphs. Personally, I usually write a gnuplot command file (call it, say, gnuplot_in), using a script of some form, with the above commands for each file and plot it using gnuplot < gnuplot_in.To give you an example, in python:#!/usr/bin/env python3import globcommands=open(gnuplot_in, 'w')print(set xlabel Labelset ylabel Label2set term png, file=commands)for datafile in glob.iglob(Your_file_glob_pattern):    # Here, you can tweak the output png file name.    print('set output {output}.png'.format( output=datafile ), file=commands )    print('plot {file_name} using 1:2:3:4 with errorbars title Graph title'.format( file_name = datafile ), file=commands)commands.close()where Your_file_glob_pattern is something that describes the naming of your datafiles, be it * or *dat. Instead of the glob module, you can use os as well of course. Whatever generates a list of file names, really. 