mardi 6 février 2018

Event plot fails for array with binary values Python3

I am trying to plot array with binary values using eventplot

time_steps = 5
num_features = 5
values_chart = np.zeros((num_features, time_steps))
for i in range(time_steps):
    if i < time_steps // 4:
        values_chart[:, i] = np.random.binomial(1, 0.02, num_features)
    elif i < time_steps // 2:
        values_chart[:, i] = np.random.binomial(1, 0.1, num_features)
    else:
        values_chart[:, i] = np.random.binomial(1, 0.02, num_features)

print(values_chart)
plt.eventplot(values_chart,linelengths = 0.1)
plt.gca().invert_yaxis()
plt.ylabel('Num Features')
plt.xlabel('Timesteps')
plt.show()  

enter image description here

Test code from Eventplot

neuralData = np.random.random([5, 5])
print(neuralData)
plt.eventplot(neuralData,linelengths = 0.1)
plt.gca().invert_yaxis()
plt.show()

enter image description here

Question is, why the first plot fails? or i misunderstood eventplot? Note: Increase in timesteps/num_features has no change in result.




Aucun commentaire:

Enregistrer un commentaire