python 2.7 - Raster plot not showing symbols using plt.scatter function -
i have raster plot, of 1 neuron, 10 trials of data , time 4500 ms.
import numpy np import matplotlib.pyplot plt #plotting 1 neuron 12 trials of info maatriks = [] in range(1,14): if i<10: string = 'c:\\users\\latel\\desktop\\kool\\neuro\\prax3\\data\\lgn\\plain\\neuron_01_stimulus_0'+str(i)+'.csv' else: string = 'c:\\users\\latel\\desktop\\kool\\neuro\\prax3\\data\\lgn\\plain\\neuron_01_stimulus_'+str(i)+'.csv' data_in = np.genfromtxt(string,dtype = 'int', delimiter = ',' or '\n') maatriks.append(data_in) data = np.array(maatriks) print data.shape spikes = np.array(data[8]) print spikes.shape nonzeros = 0 i,item in enumerate(spikes): nonzeros += np.count_nonzero(item) plt.scatter(item, i*np.ones(item.shape), marker = '|') print nonzeros plt.ylim(-1,len(spikes)) plt.xlim(0,len(spikes[0])) plt.xlabel("time seconds") plt.ylabel("trial number") plt.tight_layout() plt.show() this outputs me(the prints) :
(13l, 10l, 4501l)
(10l, 4501l)
55
but plot empty , cannot understand why plot empty. there should 55 lines in opinion ...
edit: got working. added code.
for row in spikes: in range(len(row)): if (row[i] == 1): row[i] = because data 0 or 1.
anyone know how shorter ?
Comments
Post a Comment