def plot_arai(fignum, indata, s, units):
    """
    makes Arai plots for Thellier-Thellier type experiments

    Parameters
    __________
    fignum : figure number of matplotlib plot object
    indata : nested list of data for Arai plots:
        the araiblock of data prepared by pmag.sortarai()
    s : specimen name
    units : [K, J, ""] (kelvin, joules, unknown)
    Effects
    _______
    makes the Arai plot
    """
    global globals
    plt.figure(num=fignum)
    plt.clf()
    if not isServer:
        plt.figtext(.02, .01, version_num)
    x, y, x_zi, y_zi, x_iz, y_iz, xptrm, yptrm, xptrmt, yptrmt = [
    ], [], [], [], [], [], [], [], [], []
    xzptrm, yzptrm = [], []  # zero field ptrm checks
    zptrm_check = []
    first_Z, first_I, ptrm_check, ptrm_tail, zptrm_check = indata[
        0], indata[1], indata[2], indata[3], indata[4]
    if len(indata) > 6:
        if len(indata[-1]) > 1:
            s = s + ":PERP"  # there are Delta checks, must be a LP-PI-M-S perp experiment
    recnum, yes, Nptrm, Nptrmt, diffcum = 0, 0, 0, 0, 0
# plot the NRM-pTRM data
    forVDS = []
    for zrec in first_Z:
        forVDS.append([zrec[1], zrec[2], old_div(zrec[3], first_Z[0][3])])
        ZI = zrec[4]
        if zrec[0] == '0':
            irec = ['0', 0, 0, 0]
        if zrec[0] == '273' and units == 'K':
            irec = ['273', 0, 0, 0]
        else:
            for irec in first_I:
                if irec[0] == zrec[0]:
                    break
# save the NRM data used for calculation in Vi
        x.append(old_div(irec[3], first_Z[0][3]))
        y.append(old_div(zrec[3], first_Z[0][3]))
        if ZI == 1:
            x_zi.append(old_div(irec[3], first_Z[0][3]))
            y_zi.append(old_div(zrec[3], first_Z[0][3]))
        else:
            x_iz.append(old_div(irec[3], first_Z[0][3]))
            y_iz.append(old_div(zrec[3], first_Z[0][3]))
        plt.text(x[-1], y[-1], (' ' + str(recnum)), fontsize=9)
        recnum += 1
# now deal with ptrm checks.
    if len(ptrm_check) != 0:
        for prec in ptrm_check:
            step = prec[0]
            for zrec in first_Z:
                if zrec[0] == step:
                    break
            xptrm.append(old_div(prec[3], first_Z[0][3]))
            yptrm.append(old_div(zrec[3], first_Z[0][3]))
# now deal with zptrm checks.
    if len(zptrm_check) != 0:
        for prec in zptrm_check:
            step = prec[0]
            for zrec in first_Z:
                if zrec[0] == step:
                    break
            xzptrm.append(old_div(prec[3], first_Z[0][3]))
            yzptrm.append(old_div(zrec[3], first_Z[0][3]))
# and the pTRM tails
    if len(ptrm_tail) != 0:
        for trec in ptrm_tail:
            step = trec[0]
            for irec in first_I:
                if irec[0] == step:
                    break
            xptrmt.append(old_div(irec[3], first_Z[0][3]))
            yptrmt.append((old_div(trec[3], first_Z[0][3])))
# now plot stuff
    if len(x) == 0:
        print("Can't do nuttin for ya")
        return
    try:
        if len(x_zi) > 0:
            plt.scatter(x_zi, y_zi, marker='o', c='r',
                        edgecolors="none")  # zero field-infield
        if len(x_iz) > 0:
            plt.scatter(x_iz, y_iz, marker='s', c='b',
                        faceted="True")  # infield-zerofield
    except:
        if len(x_zi) > 0:
            plt.scatter(x_zi, y_zi, marker='o', c='r')  # zero field-infield
        if len(x_iz) > 0:
            plt.scatter(x_iz, y_iz, marker='s', c='b')  # infield-zerofield
    plt.plot(x, y, 'r')
    if globals != 0:
        globals.MTlist = x
        globals.MTlisty = y
    if len(xptrm) > 0:
        plt.scatter(xptrm, yptrm, marker='^', c='g', s=80)
    if len(xzptrm) > 0:
        plt.scatter(xzptrm, yzptrm, marker='v', c='c', s=80)
    if len(xptrmt) > 0:
        plt.scatter(xptrmt, yptrmt, marker='s', c='b', s=80)
    try:
        plt.axhline(0, color='k')
        plt.axvline(0, color='k')
    except:
        pass
    plt.xlabel("pTRM gained")
    plt.ylabel("NRM remaining")
    tstring = s + ': NRM = ' + '%9.2e' % (first_Z[0][3])
    plt.title(tstring)
# put on VDS
    vds = pmag.dovds(forVDS)
    plt.axhline(vds, color='b')
    plt.text(1., vds - .1, ('VDS '), fontsize=9)
makes Arai plots for Thellier-Thellier type experiments

    Parameters
    __________
    fignum : figure number of matplotlib plot object
    indata : nested list of data for Arai plots:
        the araiblock of data prepared by pmag.sortarai()
    s : specimen name
    units : [K, J, ""] (kelvin, joules, unknown)
    Effects
    _______
    makes the Arai plot