|
32 | 32 | lineoffsets1=np.array([-15,-3,1,1.5,6,10]) |
33 | 33 | linelengths1= [5,2,1,1,3,1.5] |
34 | 34 |
|
35 | | -fig=plt.figure() |
| 35 | +fig,axs=plt.subplots(2,2) |
36 | 36 |
|
37 | 37 | # create a horizontal plot |
38 | | -ax1=fig.add_subplot(221) |
39 | | -ax1.eventplot(data1,colors=colors1,lineoffsets=lineoffsets1, |
40 | | -linelengths=linelengths1) |
41 | | - |
| 38 | +axs[0,0].eventplot(data1,colors=colors1,lineoffsets=lineoffsets1, |
| 39 | +linelengths=linelengths1) |
42 | 40 |
|
43 | 41 | # create a vertical plot |
44 | | -ax2=fig.add_subplot(223) |
45 | | -ax2.eventplot(data1,colors=colors1,lineoffsets=lineoffsets1, |
46 | | -linelengths=linelengths1,orientation='vertical') |
| 42 | +axs[1,0].eventplot(data1,colors=colors1,lineoffsets=lineoffsets1, |
| 43 | +linelengths=linelengths1,orientation='vertical') |
47 | 44 |
|
48 | 45 | # create another set of random data. |
49 | 46 | # the gamma distribution is only used fo aesthetic purposes |
|
57 | 54 | linelengths2=1 |
58 | 55 |
|
59 | 56 | # create a horizontal plot |
60 | | -ax1=fig.add_subplot(222) |
61 | | -ax1.eventplot(data2,colors=colors2,lineoffsets=lineoffsets2, |
62 | | -linelengths=linelengths2) |
| 57 | +axs[0,1].eventplot(data2,colors=colors2,lineoffsets=lineoffsets2, |
| 58 | +linelengths=linelengths2) |
63 | 59 |
|
64 | 60 |
|
65 | 61 | # create a vertical plot |
66 | | -ax2=fig.add_subplot(224) |
67 | | -ax2.eventplot(data2,colors=colors2,lineoffsets=lineoffsets2, |
68 | | -linelengths=linelengths2,orientation='vertical') |
| 62 | +axs[1,1].eventplot(data2,colors=colors2,lineoffsets=lineoffsets2, |
| 63 | +linelengths=linelengths2,orientation='vertical') |
69 | 64 |
|
70 | 65 | plt.show() |