Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Problem with eventplot - error message claims events & lineoffsets are unequal sizes #16546

Closed
@oscr104

Description

@oscr104

Bug report

Matplotlib.pyplot eventplot function is raising an error when i try to generate a raster plot. Given a sequence of event timings, and an equally sized sequence of lineoffsets, the error message 'ValueError: lineoffsets and positions are unequal sized sequences' is returned. Changing the dtype to np.array for both variables does not help.

Reproducible with:

import matplotlib.pyplot as plt

events=[197, 2175, 4153] # event timings for a single subject
lineoffsets = [1, 1, 1]
plt.eventplot(events, lineoffsets=lineoffsets)

Actual outcome
Traceback (most recent call last):
File "", line 1, in
File "/home/nd17878/anaconda3/lib/python3.7/site-packages/matplotlib/pyplot.py", line 2567, in eventplot
else {}), **kwargs)
File "/home/nd17878/anaconda3/lib/python3.7/site-packages/matplotlib/init.py", line 1589, in inner
return func(ax, *map(sanitize_sequence, args), **kwargs)
File "/home/nd17878/anaconda3/lib/python3.7/site-packages/matplotlib/axes/_axes.py", line 1376, in eventplot
raise ValueError('lineoffsets and positions are unequal sized '
ValueError: lineoffsets and positions are unequal sized sequences

lineoffsets = [1,3]
plt.eventplot(events, lineoffsets=lineoffsets)
Traceback (most recent call last):
File "", line 1, in
File "/home/nd17878/anaconda3/lib/python3.7/site-packages/matplotlib/pyplot.py", line 2567, in eventplot
else {}), **kwargs)
File "/home/nd17878/anaconda3/lib/python3.7/site-packages/matplotlib/init.py", line 1589, in inner
return func(ax, *map(sanitize_sequence, args), **kwargs)
File "/home/nd17878/anaconda3/lib/python3.7/site-packages/matplotlib/axes/_axes.py", line 1376, in eventplot
raise ValueError('lineoffsets and positions are unequal sized '
ValueError: lineoffsets and positions are unequal sized sequences

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions