Function to produce a general 2D plot.

    Args:
        x (list): x points.
        y (list): y points.
        filename (str): Filename of the output image.
        title (str): Title of the plot.  Default is '' (no title).
        x_label (str): x-axis label.
        y_label (str): y-axis label.

def gnuplot_2d(x, y, filename, title='', x_label='', y_label=''):
    '''
    Function to produce a general 2D plot.

    Args:
        x (list): x points.
        y (list): y points.
        filename (str): Filename of the output image.
        title (str): Title of the plot.  Default is '' (no title).
        x_label (str): x-axis label.
        y_label (str): y-axis label.
    '''
    _, ext = os.path.splitext(filename)
    if ext != '.png':
        filename += '.png'

    gnuplot_cmds = \
    '''
    set datafile separator ","
    set term pngcairo size 30cm,25cm
    set out filename

    unset key
    set border lw 1.5
    set grid lt -1 lc rgb "gray80"

    set title title
    set xlabel x_label
    set ylabel y_label

    plot filename_data u 1:2 w lp pt 6 ps 0.5
    '''
    scr = _GnuplotScriptTemp(gnuplot_cmds)
    data = _GnuplotDataTemp(x, y)

    args_dict = {
        'filename': filename,
        'filename_data': data.name,
        'title': title,
        'x_label': x_label,
        'y_label': y_label
    }
    gnuplot(scr.name, args_dict)