On 18 May 2014 16:10, mainakjas <notifications@github.com> wrote:

> In mne/viz.py:
>
> > @@ -3874,15 +3883,96 @@ def plot_events(events, sfreq, first_samp=0, show=True):
> >      fig : matplotlib.figure.Figure
> >          The figure object containing the plot.
> >      """
> > +    if event_id is None:
> > +        unique_events = np.unique(events[:, 2])
> > +    else:
> > +        # get labels and unique event ids from event_id dict,
> > +        # sorted by value
> > +        labels, unique_events = zip(*sorted(event_id.items(),
> > +                                    key=lambda x: x[1]))
> > +
> > +        # check that event_id values match existing events
> > +        venn_ev = set(unique_events).intersection(set(np.unique(events[:, 2])))
> > +        if not venn_ev:
> > +            warnings.warn('These event_ids do not exist. Existing events will'
> > +                          ' be plotted with default colors.')
> > +            unique_events = np.unique(events[:, 2])
> > +            event_id = None
>
> event_id, color = None, None
>
> might be more pythonic
>
ok

> —
> Reply to this email directly or view it on GitHub<https://github.com/mne-tools/mne-python/pull/1266/files#r12776078>
> .
>