From 297c731166710d2941d7a237c6e7df98a1c39623 Mon Sep 17 00:00:00 2001 From: Jan Benda Date: Thu, 9 Jan 2020 09:49:27 +0100 Subject: [PATCH] [plotstyle] line styles of spines and grid --- plotstyle.py | 26 ++++++++++++++----- .../lecture/pointprocesses-chapter.tex | 1 + pointprocesses/lecture/sta.py | 6 ++--- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/plotstyle.py b/plotstyle.py index 23206a4..fd4e95b 100644 --- a/plotstyle.py +++ b/plotstyle.py @@ -80,16 +80,18 @@ colors = { colors_bendalab = {} colors_bendalab['red'] = '#C02010' colors_bendalab['orange'] = '#F78010' -colors_bendalab['yellow'] = '#F7E030' -colors_bendalab['green'] = '#97C010' +colors_bendalab['yellow'] = '#F0D730' +colors_bendalab['green'] = '#A0B717' colors_bendalab['cyan'] = '#40A787' -colors_bendalab['blue'] = '#2050A0' -colors_bendalab['purple'] = '#7040A0' -colors_bendalab['pink'] = '#D72060' +colors_bendalab['blue'] = '#2757A0' +colors_bendalab['purple'] = '#573790' +colors_bendalab['pink'] = '#C72750' +colors_bendalab['grey'] = '#A0A0A0' +colors_bendalab['black'] = '#000000' """ Vivid colors used by the Benda-lab. """ colors_bendalab_vivid = {} -colors_bendalab_vivid['red'] = '#D01000' +colors_bendalab_vivid['red'] = '#D71000' colors_bendalab_vivid['orange'] = '#FF9000' colors_bendalab_vivid['yellow'] = '#FFF700' colors_bendalab_vivid['green'] = '#30D700' @@ -97,6 +99,8 @@ colors_bendalab_vivid['cyan'] = '#00F0B0' colors_bendalab_vivid['blue'] = '#0020C0' colors_bendalab_vivid['purple'] = '#B000B0' colors_bendalab_vivid['pink'] = '#F00080' +colors_bendalab_vivid['grey'] = '#A7A7A7' +colors_bendalab_vivid['black'] = '#000000' # colors for the plots of the script: colors = colors_bendalab_vivid @@ -104,7 +108,10 @@ colors['lightorange'] = colors['yellow'] #colors['yellow'] = lighter(colors['yellow'], 0.65) colors['yellow'] = '#FFFF55' -# line styles: +# line styles for plot(): +lsSpine = {'c': colors['black'], 'linestyle': '-', 'linewidth': 1} +lsGrid = {'c': colors['grey'], 'linestyle': '--', 'linewidth': 1} + # 'B1': prominent line with first color and style from color group 'B' # 'C2m': minor line with second color and style from color group 'C' ls = { @@ -354,7 +361,12 @@ def common_format(): mpl.rcParams['ytick.direction'] = 'out' mpl.rcParams['xtick.major.width'] = 1.25 mpl.rcParams['ytick.major.width'] = 1.25 + mpl.rcParams['grid.color'] = lsGrid['c'] + mpl.rcParams['grid.linestyle'] = lsGrid['linestyle'] + mpl.rcParams['grid.linewidth'] = lsGrid['linewidth'] mpl.rcParams['axes.facecolor'] = 'none' + mpl.rcParams['axes.edgecolor'] = lsSpine['c'] + mpl.rcParams['axes.linewidth'] = lsSpine['linewidth'] if 'axes.prop_cycle' in mpl.rcParams: mpl.rcParams['axes.prop_cycle'] = cycler(color=[colors['blue'], colors['red'], colors['orange'], colors['green'], diff --git a/pointprocesses/lecture/pointprocesses-chapter.tex b/pointprocesses/lecture/pointprocesses-chapter.tex index 897a5ac..0223ee7 100644 --- a/pointprocesses/lecture/pointprocesses-chapter.tex +++ b/pointprocesses/lecture/pointprocesses-chapter.tex @@ -21,6 +21,7 @@ \section{TODO} \begin{itemize} \item Explain difference stationary versus non-stationary point process +\item Show different types of ISI histograms (regular, noisy, poisson, bursty, locking) \item Multitrial firing rates \item Choice of bin width for PSTH, kernel width, also in relation sto stimulus time scale diff --git a/pointprocesses/lecture/sta.py b/pointprocesses/lecture/sta.py index 5bc9059..674fb7f 100644 --- a/pointprocesses/lecture/sta.py +++ b/pointprocesses/lecture/sta.py @@ -53,8 +53,8 @@ def plot_results(sta_time, st_average, stim_time, s_est, stimulus, duration, dt) sta_ax.set_yticks(np.arange(-0.1, 0.21, 0.1)) ylim = sta_ax.get_ylim() xlim = sta_ax.get_xlim() - sta_ax.plot(list(xlim), [0., 0.], zorder=1, color='darkgray', ls='--', lw=1) - sta_ax.plot([0., 0.], list(ylim), zorder=1, color='darkgray', ls='--', lw=1) + sta_ax.plot(list(xlim), [0., 0.], zorder=1, **lsGrid) + sta_ax.plot([0., 0.], list(ylim), zorder=1, **lsGrid) sta_ax.set_xlim(list(xlim)) sta_ax.set_ylim(list(ylim)) sta_ax.annotate('Time of\nspike', @@ -75,7 +75,7 @@ def plot_results(sta_time, st_average, stim_time, s_est, stimulus, duration, dt) stim_ax.set_xlim(0.0, 200) stim_ax.set_ylim([-1., 1.]) stim_ax.legend(loc=(0.3, 0.85), frameon=False) - stim_ax.plot([0.0, 250], [0., 0.], color="darkgray", lw=1, ls='--', zorder=1) + stim_ax.plot([0.0, 250], [0., 0.], zorder=1, **lsGrid) #stim_ax.text(-0.1, 1.04, "B", transform=stim_ax.transAxes, size=24) fig.savefig("sta.pdf")