On 11 May 2014 07:02, 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)
>
> You need a dict that looks like this
>
> {5: 'black', 32: 'blue', ...}
>
> If it is already like that that's fine , if not reverse it as shown above.
> Makes sense?
>
@dengemann The color dict is is defined by the user anyway so it can be in
whatever order you want. You had originally put it in this order (number:
'color string'):

color = {1: 'green', 2: 'yellow', 3: 'red', 4: 'c', 5: 'black', 32: 'blue'}

but the problem is this line: [color[i] for i in event_id]
because event_id = {'aud_l': 1, 'aud_r': 2, 'vis_l': 3, 'vis_r': 4,
'cond_l': 5, 'cond_r': 32},
so the i in "for i in event_id" =
cond_l
vis_r
aud_l
aud_r
vis_l
cond_r

and therefore color[i] won't work

>  —
> Reply to this email directly or view it on GitHub<https://github.com/mne-tools/mne-python/pull/1266/files#r12508368>
> .
>