Skip to content

Conversation

@drammock
Copy link
Member

@drammock drammock commented Apr 5, 2021

Currently this:

mne.viz.plot_compare_evokeds(evoked, combine=None, picks=picks, axes=axs)

compares axes to a string, where axes is a list of matplotlib axes objects, and raises this:

ValueError                                Traceback (most recent call last)
<ipython-input-8-e36b566cce17> in <module>
----> 1 foo = mne.viz.plot_compare_evokeds({'mean': evoked}, combine=None, picks=picks, axes=axs)

/opt/mne/python/mne/viz/evoked.py in plot_compare_evokeds(evokeds, picks, colors, linestyles, styles, cmap, vlines, ci, truncate_yaxis, truncate_xaxis, ylim, invert_y, show_sensors, legend, split_legend, axes, title, show, combine, sphere)
   2252              .format(len(picks), combine))
   2253     # `combine` defaults to GFP unless picked a single channel or axes='topo'
-> 2254     if combine is None and len(picks) > 1 and axes != 'topo':
   2255         combine = 'gfp'
   2256     # convert `combine` into callable (if None or str)

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

This PR fixes it.

Copy link
Member

@larsoner larsoner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM +1 for merge

@agramfort agramfort merged commit d33e105 into mne-tools:main Apr 6, 2021
@agramfort
Copy link
Member

thx @drammock

@drammock drammock deleted the fix-plot-compare-evokeds branch April 6, 2021 14:05
vagechirkov pushed a commit to vagechirkov/mne-python that referenced this pull request Apr 6, 2021
* fix comparing array to string

* update changelog

* fix: prev changelog entry in wrong place
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants