#%% [markdown] # This snippet plots a spiking train in a raster plot. # `spike_times` contains the timestamp for each even in the spike train. #%% import numpy as np import matplotlib.pyplot as plt import seaborn as sns # Set the theme sns.set_style("white") # generate random timestamps (0 to 100s) spike_times = np.random.random([8,50]) * 100 #* creating the plot. It also accepts color and linelength as arrays for colors and lengths. plt.eventplot(spike_times, color="blue", linelength=0.9) # title and axis plt.title("Sample spike train plot") plt.xlabel("time") # plt.ylabel("channels") #plt.axis('off') plt.yticks(np.arange(0, 8),[f'Channel {l+1}' for l in range(8)]) plt.show() #%%