This should be quite easy to reproduce:
plt.eventplot(positions=[1, 2, 3], lineoffsets=[1, 2, 3])
raises
ValueError: lineoffsets and positions are unequal sized sequences
For reasons I can't figure out, because they clearly aren't.
If I understand correctly you want to plot 3 lines, at different starting heights (offsets). The way this works with plt.eventplot
is as follows:
import numpy as np
import matplotlib.pyplot as plt
positions = np.array([1, 2, 3])[:,np.newaxis] # or np.array([[1], [2], [3]])
offsets = [1,2,3]
plt.eventplot(positions, lineoffsets=offsets)
plt.show()
You have to set the offset for each group of data you want to plot. In your case, you have to divide the list into a 3D array (shape (m,n)
with m
the number of datasets, and n
number of data points per set). This way plt.eventplot
knows it has to use the different offsets for each group of data. Also see this example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With