On 10 May 2014 14:18, Denis A. Engemann <notifications@github.com> wrote:

> In mne/viz.py:
>
> > +            c = sorted_x[i][1]
> > +            d = sorted_x[i][0]
> > +            unique_events.append(c)
> > +            unique_events_label.append(d)
> > +
> > +    if color is None:
> > +        colors = cycle(COLORS)
> > +        if len(unique_events) > len(COLORS):
> > +            warnings.warn('More events than colors available.'
> > +                          'You should pass a list of unique colors.')
> > +    else:  # take color from dictionary according to event_id
> > +        colors = list()
> > +        ev_id = [index for index in unique_events]
> > +        for i in range(len(ev_id)):
> > +            c = color[ev_id[i]]
> > +            colors.append(c)
>
> Maybe this isimpler:
>
> # reverse color dict
> id_to_color =  dict((v, k) for k, v in colors.items())
>
> # look up colors
> colors = [id_to_color[i] for i in event_id]
>
> @dengemann do you mean color.items()? That gives:
 {'black': 5, 'blue': 32, 'c': 4, 'green': 1, 'red': 3, 'yellow': 2}

but the i in "for i in event_id" is:
cond_l
vis_r
aud_l
aud_r
vis_l
cond_r

which can't be used to index id_to_color

 —
> Reply to this email directly or view it on GitHub<https://github.com/mne-tools/mne-python/pull/1266/files#r12505464>
> .
>