From 1ce7acb2ea1085ec3b6a454b8536cdc725b0019e Mon Sep 17 00:00:00 2001 From: Jan Benda Date: Tue, 26 Jan 2021 09:19:52 +0100 Subject: [PATCH] [pointprocesses] fixed raster plot --- plotstyle.py | 2 +- pointprocesses/lecture/rasterexamples.py | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/plotstyle.py b/plotstyle.py index add3e40..eb04d7d 100644 --- a/plotstyle.py +++ b/plotstyle.py @@ -282,7 +282,7 @@ def axis_label(label, unit=None): if not unit: return label elif xkcd_style: - return '%s/%s' % (label, unit) + return '%s (%s)' % (label, unit) else: return '%s [%s]' % (label, unit) diff --git a/pointprocesses/lecture/rasterexamples.py b/pointprocesses/lecture/rasterexamples.py index 7a9f4f0..3bc6ea5 100644 --- a/pointprocesses/lecture/rasterexamples.py +++ b/pointprocesses/lecture/rasterexamples.py @@ -69,7 +69,9 @@ def plot_homogeneous_spikes(ax): ax.set_title('stationary') ax.set_xlim(0.0, duration) 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.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_xlim(0.0, duration) ax.set_ylim(-0.5, trials-0.5) - ax.set_xlabel('Time [s]') - ax.set_ylabel('Trial') + 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.eventplot(inhspikes, colors=[lsA['color']], linelength=0.8, lw=1) if __name__ == "__main__": 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_inhomogeneous_spikes(ax2) plt.savefig('rasterexamples.pdf')