Closed
Description
plt.eventplot([[]], colors=[(0.0, 0.0, 0.0, 0.0)])
will fail with the following exception:
/home/jgosmann/virt_env/default/local/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/pyplot.pyc in eventplot(positions, orientation, lineoffsets, linelengths, linewidths, colors, linestyles, hold, **kwargs)
2718 lineoffsets=lineoffsets, linelengths=linelengths,
2719 linewidths=linewidths, colors=colors,
-> 2720 linestyles=linestyles, **kwargs)
2721 draw_if_interactive()
2722 finally:
/home/jgosmann/virt_env/default/local/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/axes.pyc in eventplot(self, positions, orientation, lineoffsets, linelengths, linewidths, colors, linestyles, **kwargs)
3987
3988 if len(positions) > 0:
-> 3989 minpos = min(position.min() for position in positions)
3990 maxpos = max(position.max() for position in positions)
3991
/home/jgosmann/virt_env/default/local/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/axes.pyc in <genexpr>((position,))
3987
3988 if len(positions) > 0:
-> 3989 minpos = min(position.min() for position in positions)
3990 maxpos = max(position.max() for position in positions)
3991
/home/jgosmann/virt_env/default/local/lib/python2.7/site-packages/numpy/core/_methods.pyc in _amin(a, axis, out, keepdims)
19 def _amin(a, axis=None, out=None, keepdims=False):
20 return um.minimum.reduce(a, axis=axis,
---> 21 out=out, keepdims=keepdims)
22
23 def _sum(a, axis=None, dtype=None, out=None, keepdims=False):
ValueError: zero-size array to reduction operation minimum which has no identity
I think, this case should be handled more gracefully. Having a timeslice without any events can be a quite standard thing depending on the analysis one performs. Having to handle this special case always outside the function before plotting can be quite annoying (and one has also take care of labels matching after removing empty sequences out of the list).
Metadata
Metadata
Assignees
Labels
No labels