[pointprocesses] fixed raster plot

This commit is contained in:
Jan Benda 2021-01-26 09:19:52 +01:00
parent d7415a85b2
commit 1ce7acb2ea
2 changed files with 9 additions and 5 deletions

View File

@ -282,7 +282,7 @@ def axis_label(label, unit=None):
if not unit: if not unit:
return label return label
elif xkcd_style: elif xkcd_style:
return '%s/%s' % (label, unit) return '%s (%s)' % (label, unit)
else: else:
return '%s [%s]' % (label, unit) return '%s [%s]' % (label, unit)

View File

@ -69,7 +69,9 @@ def plot_homogeneous_spikes(ax):
ax.set_title('stationary') ax.set_title('stationary')
ax.set_xlim(0.0, duration) ax.set_xlim(0.0, duration)
ax.set_ylim(-0.5, trials-0.5) ax.set_ylim(-0.5, trials-0.5)
ax.set_xlabel('Time [s]') ax.set_xticks([0, 1, 2])
ax.set_yticks(np.arange(0, trials+1, 5))
ax.set_xlabel('Time', 's')
ax.set_ylabel('Trial') ax.set_ylabel('Trial')
ax.eventplot(homspikes, colors=[lsA['color']], linelength=0.8, lw=1) ax.eventplot(homspikes, colors=[lsA['color']], linelength=0.8, lw=1)
@ -79,14 +81,16 @@ def plot_inhomogeneous_spikes(ax):
ax.set_title('non-stationary') ax.set_title('non-stationary')
ax.set_xlim(0.0, duration) ax.set_xlim(0.0, duration)
ax.set_ylim(-0.5, trials-0.5) ax.set_ylim(-0.5, trials-0.5)
ax.set_xlabel('Time [s]') ax.set_xticks([0, 1, 2])
ax.set_ylabel('Trial') ax.set_yticks(np.arange(0, trials+1, 5))
ax.set_xlabel('Time', 's')
#ax.set_ylabel('Trial')
ax.eventplot(inhspikes, colors=[lsA['color']], linelength=0.8, lw=1) ax.eventplot(inhspikes, colors=[lsA['color']], linelength=0.8, lw=1)
if __name__ == "__main__": if __name__ == "__main__":
fig, (ax1, ax2) = plt.subplots(1, 2) fig, (ax1, ax2) = plt.subplots(1, 2)
fig.subplots_adjust(**adjust_fs(fig, left=4.0, right=1.0, top=1.2)) fig.subplots_adjust(**adjust_fs(fig, left=5.0, right=1.0, top=1.2))
plot_homogeneous_spikes(ax1) plot_homogeneous_spikes(ax1)
plot_inhomogeneous_spikes(ax2) plot_inhomogeneous_spikes(ax2)
plt.savefig('rasterexamples.pdf') plt.savefig('rasterexamples.pdf')