1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
| import matplotlib.pyplot as plt import numpy as np import matplotlib matplotlib.rcParams['font.size'] = 8.0
np.random.seed(19680801)
data1 = np.random.random([6, 50])
colors1 = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1], [1, 1, 0], [1, 0, 1], [0, 1, 1]])
lineoffsets1 = np.array([-15, -3, 1, 1.5, 6, 10]) linelengths1 = [5, 2, 1, 1, 3, 1.5]
fig, axs = plt.subplots(2, 2)
axs[0, 0].eventplot(data1, colors=colors1, lineoffsets=lineoffsets1, linelengths=linelengths1)
axs[1, 0].eventplot(data1, colors=colors1, lineoffsets=lineoffsets1, linelengths=linelengths1, orientation='vertical')
data2 = np.random.gamma(4, size=[60, 50])
colors2 = [[0, 0, 0]] lineoffsets2 = 1 linelengths2 = 1
axs[0, 1].eventplot(data2, colors=colors2, lineoffsets=lineoffsets2, linelengths=linelengths2)
axs[1, 1].eventplot(data2, colors=colors2, lineoffsets=lineoffsets2, linelengths=linelengths2, orientation='vertical')
plt.show()
|