Plt.eventplot refuses linear calculations
1 answer
If I understand correctly, you want to plot 3 lines at different starting heights (offsets). The way it 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 must set an offset for each group of data you want to plot. In your case, you need to split the list into a 3D array (a shape (m,n)
with the m
number of datasets and the n
number of data points in the dataset). Thus, plt.eventplot
knows that he must use different offsets for each data group. Also see this example.
+2
source to share