// Spikes at time 0 are forbidden (and indeed prevented in the
// simulation), because of this difficulty to distinguish them from a 0
// entry indicating no spike.
spiketrain = spiketrain[spiketrain.nonzero()]
// Create an array of the same size as the spikelist containing just
// the neuron index.
y = np.ones_like(spiketrain) * neuron
plt.plot(spiketrain, y, ".")
plt.title("Spiketrains \n of layer {}".format(layer[1]))
plt.xlabel("time [ms]")
plt.ylabel("neuron index")
After Change
plt.title("Spiketrains \n of layer {}".format(layer[1]))
plt.xlabel("time [ms]")
plt.ylabel("neuron index")
plt.xlim(min([dt, np.min(layer[0])]), (duration + 1) * dt)
if path is not None:
filename = "7Spiketrains"
plt.savefig(os.path.join(path, filename), bbox_inches="tight")