def import_for_plots(dat):
    """
    Import data to plot.

    Parameters
    ----------
    dat : list
        List of events.

    Returns
    -------
    datd : dictionary
        Dictionary of data to plot.

    """
    datd = {}
    for event in dat:
        if '1' not in event:
            continue
        for rectype in event:
            if rectype in ('1', 'E'):
                tmp = vars(event[rectype])
                for j in tmp:
                    newkey = rectype + '_' + j
                    if newkey not in datd:
                        datd[newkey] = []
                    datd[newkey].append(tmp[j])
                    if 'type_of_magnitude' in j:
                        newkey = '1_M' + tmp[j]
                        if newkey not in datd:
                            datd[newkey] = []
                        datd[newkey].append(tmp[j.split('_of_')[1]])
                        time = tmp['hour'] + tmp['minutes'] / 60.0 + tmp[
                            'seconds'] / 3600.0
                        newkey = '1_M' + tmp[j] + '_time'
                        if newkey not in datd:
                            datd[newkey] = []
                        datd[newkey].append(time)
                        newkey = '1_M' + tmp[j] + '_year'
                        if newkey not in datd:
                            datd[newkey] = []
                        datd[newkey].append(tmp['year'])
            if rectype == '4':
                for i in event[rectype]:
                    tmp = vars(i)
                    for j in tmp:
                        newkey = rectype + '_' + j
                        if newkey not in datd:
                            datd[newkey] = []
                        datd[newkey].append(tmp[j])
    return datd
