diff --git a/plotstyle.py b/plotstyle.py index de5d5fd..82d084e 100644 --- a/plotstyle.py +++ b/plotstyle.py @@ -12,125 +12,57 @@ figure_height = 6.0 # cm, for a 1 x 2 figure ppi = 72.0 # colors: +colors = {} +colors['red'] = '#CC0000' +colors['orange'] = '#FF9900' +colors['lightorange'] = '#FFCC00' +colors['yellow'] = '#FFFF66' +colors['green'] = '#99FF00' +colors['blue'] = '#0000CC' +colors['gray'] = '#A7A7A7' +colors['black'] = '#000000' + +#colors_bendalab_vivid['red'] = '#D71000' +#colors_bendalab_vivid['orange'] = '#FF9000' +#colors_bendalab_vivid['yellow'] = '#FFF700' +#colors_bendalab_vivid['green'] = '#30D700' +#colors_bendalab_vivid['blue'] = '#0020C0' -def lighter(color, lightness): - """ Make a color lighter. +# line styles for plot(): +lwthick = 4.0 +lwthin = 2.0 +fillalpha = 0.5 - Parameters - ---------- - color: string - An RGB color as a hexadecimal string (e.g. '#rrggbb'). - lightness: float - The smaller the lightness, the lighter the returned color. - A lightness of 1 leaves the color untouched. - A lightness of 0 returns white. +# helper lines: +lsSpine = {'c': colors['black'], 'linestyle': '-', 'linewidth': 1} +lsGrid = {'c': colors['gray'], 'linestyle': '--', 'linewidth': 1} +lsMarker = {'c': colors['black'], 'linestyle': '-', 'linewidth': 2} - Returns - ------- - color: string - The lighter color as a hexadecimal RGB string (e.g. '#rrggbb'). - """ - r = int(color[1:3], 16) - g = int(color[3:5], 16) - b = int(color[5:7], 16) - rl = r + (1.0-lightness)*(0xff - r) - gl = g + (1.0-lightness)*(0xff - g) - bl = b + (1.0-lightness)*(0xff - b) - return '#%02X%02X%02X' % (rl, gl, bl) +# line styles and fill styles: +lsA = {'color': colors['blue'], 'linestyle': '-', 'linewidth': lwthick} +lsAm = {'color': colors['blue'], 'linestyle': '-', 'linewidth': lwthin} +fsAa = {'facecolor': colors['blue'], 'edgecolor': 'none', 'alpha': fillalpha} +lsB = {'color': colors['red'], 'linestyle': '-', 'linewidth': lwthick} +lsBm = {'color': colors['red'], 'linestyle': '-', 'linewidth': lwthin} +fsB = {'facecolor': colors['red'], 'edgecolor': colors['black'], 'linewidth': 1} +fsBs = {'facecolor': colors['red'], 'edgecolor': 'none'} +fsBa = {'facecolor': colors['red'], 'edgecolor': 'none', 'alpha': fillalpha} -def darker(color, saturation): - """ Make a color darker. +lsC = {'color': colors['lightorange'], 'linestyle': '-', 'linewidth': lwthick} +lsCm = {'color': colors['lightorange'], 'linestyle': '-', 'linewidth': lwthin} +fsC = {'facecolor': colors['lightorange'], 'edgecolor': colors['black'], 'linewidth': 1} +fsCs = {'facecolor': colors['lightorange'], 'edgecolor': 'none'} +fsCa = {'facecolor': colors['lightorange'], 'edgecolor': 'none', 'alpha': fillalpha} - Parameters - ---------- - color: string - An RGB color as a hexadecimal string (e.g. '#rrggbb'). - saturation: float - The smaller the saturation, the darker the returned color. - A saturation of 1 leaves the color untouched. - A saturation of 0 returns black. - - Returns - ------- - color: string - The darker color as a hexadecimal RGB string (e.g. '#rrggbb'). - """ - r = int(color[1:3], 16) - g = int(color[3:5], 16) - b = int(color[5:7], 16) - rd = r * saturation - gd = g * saturation - bd = b * saturation - return '#%02X%02X%02X' % (rd, gd, bd) +fsD = {'facecolor': colors['orange'], 'edgecolor': colors['black'], 'linewidth': 1} +fsDs = {'facecolor': colors['orange'], 'edgecolor': 'none'} +fsE = {'facecolor': colors['yellow'], 'edgecolor': colors['black'], 'linewidth': 1} +fsEs = {'facecolor': colors['yellow'], 'edgecolor': 'none'} -# colors: -colors = { - 'red': '#CC0000', - 'orange': '#FF9900', - 'lightorange': '#FFCC00', - 'yellow': '#FFFF66', - 'green': '#99FF00', - 'blue': '#0000CC' - } - -""" Muted colors used by the Benda-lab. """ -colors_bendalab = {} -colors_bendalab['red'] = '#C02010' -colors_bendalab['orange'] = '#F78010' -colors_bendalab['yellow'] = '#F0D730' -colors_bendalab['green'] = '#A0B717' -colors_bendalab['cyan'] = '#40A787' -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'] = '#D71000' -colors_bendalab_vivid['orange'] = '#FF9000' -colors_bendalab_vivid['yellow'] = '#FFF700' -colors_bendalab_vivid['green'] = '#30D700' -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 -colors['lightorange'] = colors['yellow'] -#colors['yellow'] = lighter(colors['yellow'], 0.65) -colors['yellow'] = '#FFFF55' - -# 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 = { - 'A1': {'c': colors['red'], 'linestyle': '-', 'linewidth': 3}, - 'A2': {'c': colors['orange'], 'linestyle': '-', 'linewidth': 3}, - 'A3': {'c': colors['lightorange'], 'linestyle': '-', 'linewidth': 3}, - 'B1': {'c': colors['orange'], 'linestyle': '-', 'linewidth': 3}, - 'B2': {'c': colors['lightorange'], 'linestyle': '-', 'linewidth': 3}, - 'B3': {'c': colors['yellow'], 'linestyle': '-', 'linewidth': 3}, - 'C1': {'c': colors['green'], 'linestyle': '-', 'linewidth': 3}, - 'D1': {'c': colors['blue'], 'linestyle': '-', 'linewidth': 3}, - 'A1m': {'c': colors['red'], 'linestyle': '-', 'linewidth': 2}, - 'A2m': {'c': colors['orange'], 'linestyle': '-', 'linewidth': 2}, - 'A3m': {'c': colors['lightorange'], 'linestyle': '-', 'linewidth': 2}, - 'B1m': {'c': colors['orange'], 'linestyle': '-', 'linewidth': 2}, - 'B2m': {'c': colors['lightorange'], 'linestyle': '-', 'linewidth': 2}, - 'B3m': {'c': colors['yellow'], 'linestyle': '-', 'linewidth': 2}, - 'C1m': {'c': colors['green'], 'linestyle': '-', 'linewidth': 2}, - 'D1m': {'c': colors['blue'], 'linestyle': '-', 'linewidth': 2}, - } +fsF = {'facecolor': colors['green'], 'edgecolor': colors['black'], 'linewidth': 1} +fsFs = {'facecolor': colors['green'], 'edgecolor': 'none'} # factor for scaling widths of bars in a bar plot: bar_fac = 1.0 @@ -369,14 +301,12 @@ def common_format(): if 'axes.prop_cycle' in mpl.rcParams: from cycler import cycler mpl.rcParams['axes.prop_cycle'] = cycler(color=[colors['blue'], colors['red'], - colors['orange'], colors['green'], - colors['purple'], colors['yellow'], - colors['cyan'], colors['pink']]) + colors['lightorange'], colors['orange'], + colors['yellow'], colors['green']]) else: mpl.rcParams['axes.color_cycle'] = [colors['blue'], colors['red'], - colors['orange'], colors['green'], - colors['purple'], colors['yellow'], - colors['cyan'], colors['pink']] + colors['lightorange'], colors['orange'], + colors['yellow'], colors['green']] # overwrite axes constructor: if not hasattr(mpl.axes.Subplot, '__init__orig'): mpl.axes.Subplot.__init__orig = mpl.axes.Subplot.__init__ diff --git a/projects/README b/projects/README index cba7a86..cfbe1c5 100644 --- a/projects/README +++ b/projects/README @@ -1,94 +1,104 @@ +For new projects: +Copy project_template/ and adapt according to your needs + All projects: check for time information +1) project_activation_curve +medium +Write questions -project_adaptation_fit +2) project_adaptation_fit OK, medium Add plotting of cost function -project_eod +3) project_eod OK, medium - difficult b_0 is not defined -project_eyetracker +4) project_eyetracker OK, difficult no statistics, but kmeans -project_fano_slope +5) project_face_selectivity +medium-difficult +(Marius monkey data) + +6) project_fano_slope OK, difficult -project_fano_test +7) project_fano_test OK - -project_fano_time +8) project_fano_time OK, medium-difficult -project_ficurves +9) project_ficurves OK, medium Maybe add correlation test or fit statistics -project_input_resistance +10) project_input_resistance medium What is the problem with this project? --> No difference between segments Improve questions -project_isicorrelations +11) project_isicorrelations medium-difficult Need to finish solution -project_isipdffit +12) project_isipdffit Too technical -project_lif +13) project_lif OK, difficult no statistics -project_mutualinfo +14) project_mutualinfo OK, medium -project_noiseficurves +15) project_noiseficurves OK, simple-medium no statistics -project_numbers +16) project_numbers simple We might add some more involved statistical analysis -project_pca_natural_images +17) project_pca_natural_images medium Make a solution (->Lukas) -project_photoreceptor +18) project_photoreceptor OK, simple -project_populationvector +19) project_populationvector difficult OK -project_qvalues +20) project_power_analysis +medium + +21) project_qvalues - Interesting! But needs solution. -project_random_walk +22) project_random_walk simple-medium -project_serialcorrelation +23) project_serialcorrelation OK, simple-medium -project_spectra +24) project_shorttermpotentiation +Write questions + +25) project_spectra - Needs improvements and a solution -project_stimulus_reconstruction +26) project_stimulus_reconstruction OK, difficult -project_vector_strength +27) project_vector_strength OK, medium-difficult - -project_power_analysis -medium - -Marius monkey data: -medium-difficult \ No newline at end of file diff --git a/projects/project_activation_curve/Makefile b/projects/project_activation_curve/Makefile new file mode 100644 index 0000000..a7b3726 --- /dev/null +++ b/projects/project_activation_curve/Makefile @@ -0,0 +1,3 @@ +ZIPFILES= + +include ../project.mk diff --git a/projects/project_activation_curve/data/A1622D_01.mat b/projects/project_activation_curve/data/A1622D_01.mat new file mode 100644 index 0000000..b113bd4 Binary files /dev/null and b/projects/project_activation_curve/data/A1622D_01.mat differ diff --git a/projects/project_activation_curve/data/A1622D_02.mat b/projects/project_activation_curve/data/A1622D_02.mat new file mode 100644 index 0000000..883eb4c Binary files /dev/null and b/projects/project_activation_curve/data/A1622D_02.mat differ diff --git a/projects/project_activation_curve/data/A1622D_03.mat b/projects/project_activation_curve/data/A1622D_03.mat new file mode 100644 index 0000000..1bf0a8f Binary files /dev/null and b/projects/project_activation_curve/data/A1622D_03.mat differ diff --git a/projects/project_activation_curve/data/A1622D_04.mat b/projects/project_activation_curve/data/A1622D_04.mat new file mode 100644 index 0000000..b9f3169 Binary files /dev/null and b/projects/project_activation_curve/data/A1622D_04.mat differ diff --git a/projects/project_activation_curve/data/A1622D_05.mat b/projects/project_activation_curve/data/A1622D_05.mat new file mode 100644 index 0000000..77d79f0 Binary files /dev/null and b/projects/project_activation_curve/data/A1622D_05.mat differ diff --git a/projects/project_activation_curve/data/A1622D_06.mat b/projects/project_activation_curve/data/A1622D_06.mat new file mode 100644 index 0000000..5ec0e93 Binary files /dev/null and b/projects/project_activation_curve/data/A1622D_06.mat differ diff --git a/projects/project_activation_curve/data/A1622D_07.mat b/projects/project_activation_curve/data/A1622D_07.mat new file mode 100644 index 0000000..c134520 Binary files /dev/null and b/projects/project_activation_curve/data/A1622D_07.mat differ diff --git a/projects/project_activation_curve/data/A1622D_08.mat b/projects/project_activation_curve/data/A1622D_08.mat new file mode 100644 index 0000000..a4cdc6b Binary files /dev/null and b/projects/project_activation_curve/data/A1622D_08.mat differ diff --git a/projects/project_activation_curve/data/A1622D_09.mat b/projects/project_activation_curve/data/A1622D_09.mat new file mode 100644 index 0000000..ecfc69b Binary files /dev/null and b/projects/project_activation_curve/data/A1622D_09.mat differ diff --git a/projects/project_activation_curve/data/A1622D_10.mat b/projects/project_activation_curve/data/A1622D_10.mat new file mode 100644 index 0000000..fccaa72 Binary files /dev/null and b/projects/project_activation_curve/data/A1622D_10.mat differ diff --git a/projects/project_activation_curve/data/A1622D_11.mat b/projects/project_activation_curve/data/A1622D_11.mat new file mode 100644 index 0000000..a0fac7e Binary files /dev/null and b/projects/project_activation_curve/data/A1622D_11.mat differ diff --git a/projects/project_activation_curve/data/A1622D_12.mat b/projects/project_activation_curve/data/A1622D_12.mat new file mode 100644 index 0000000..0ee883a Binary files /dev/null and b/projects/project_activation_curve/data/A1622D_12.mat differ diff --git a/projects/project_activation_curve/data/A1622D_13.mat b/projects/project_activation_curve/data/A1622D_13.mat new file mode 100644 index 0000000..7c0a55c Binary files /dev/null and b/projects/project_activation_curve/data/A1622D_13.mat differ diff --git a/projects/project_activation_curve/data/A1622D_14.mat b/projects/project_activation_curve/data/A1622D_14.mat new file mode 100644 index 0000000..f9fd49f Binary files /dev/null and b/projects/project_activation_curve/data/A1622D_14.mat differ diff --git a/projects/project_activation_curve/data/A1622D_15.mat b/projects/project_activation_curve/data/A1622D_15.mat new file mode 100644 index 0000000..19e81c7 Binary files /dev/null and b/projects/project_activation_curve/data/A1622D_15.mat differ diff --git a/projects/project_activation_curve/data/A1622D_16.mat b/projects/project_activation_curve/data/A1622D_16.mat new file mode 100644 index 0000000..89bfff8 Binary files /dev/null and b/projects/project_activation_curve/data/A1622D_16.mat differ diff --git a/projects/project_activation_curve/data/A1622D_17.mat b/projects/project_activation_curve/data/A1622D_17.mat new file mode 100644 index 0000000..c72675b Binary files /dev/null and b/projects/project_activation_curve/data/A1622D_17.mat differ diff --git a/projects/project_activation_curve/data/WT_01.mat b/projects/project_activation_curve/data/WT_01.mat new file mode 100644 index 0000000..ab9f183 Binary files /dev/null and b/projects/project_activation_curve/data/WT_01.mat differ diff --git a/projects/project_activation_curve/data/WT_02.mat b/projects/project_activation_curve/data/WT_02.mat new file mode 100644 index 0000000..00a9e46 Binary files /dev/null and b/projects/project_activation_curve/data/WT_02.mat differ diff --git a/projects/project_activation_curve/data/WT_03.mat b/projects/project_activation_curve/data/WT_03.mat new file mode 100644 index 0000000..a89d6c9 Binary files /dev/null and b/projects/project_activation_curve/data/WT_03.mat differ diff --git a/projects/project_activation_curve/data/WT_04.mat b/projects/project_activation_curve/data/WT_04.mat new file mode 100644 index 0000000..91db57c Binary files /dev/null and b/projects/project_activation_curve/data/WT_04.mat differ diff --git a/projects/project_activation_curve/data/WT_05.mat b/projects/project_activation_curve/data/WT_05.mat new file mode 100644 index 0000000..c8c6999 Binary files /dev/null and b/projects/project_activation_curve/data/WT_05.mat differ diff --git a/projects/project_activation_curve/data/WT_06.mat b/projects/project_activation_curve/data/WT_06.mat new file mode 100644 index 0000000..1a81ddb Binary files /dev/null and b/projects/project_activation_curve/data/WT_06.mat differ diff --git a/projects/project_activation_curve/data/WT_07.mat b/projects/project_activation_curve/data/WT_07.mat new file mode 100644 index 0000000..4c1e2b3 Binary files /dev/null and b/projects/project_activation_curve/data/WT_07.mat differ diff --git a/projects/project_activation_curve/data/WT_08.mat b/projects/project_activation_curve/data/WT_08.mat new file mode 100644 index 0000000..18ec663 Binary files /dev/null and b/projects/project_activation_curve/data/WT_08.mat differ diff --git a/projects/project_activation_curve/data/WT_09.mat b/projects/project_activation_curve/data/WT_09.mat new file mode 100644 index 0000000..3a1be25 Binary files /dev/null and b/projects/project_activation_curve/data/WT_09.mat differ diff --git a/projects/project_activation_curve/data/WT_10.mat b/projects/project_activation_curve/data/WT_10.mat new file mode 100644 index 0000000..f483182 Binary files /dev/null and b/projects/project_activation_curve/data/WT_10.mat differ diff --git a/projects/project_activation_curve/data/WT_11.mat b/projects/project_activation_curve/data/WT_11.mat new file mode 100644 index 0000000..4de2bcd Binary files /dev/null and b/projects/project_activation_curve/data/WT_11.mat differ diff --git a/projects/project_activation_curve/data/WT_12.mat b/projects/project_activation_curve/data/WT_12.mat new file mode 100644 index 0000000..9b30bbe Binary files /dev/null and b/projects/project_activation_curve/data/WT_12.mat differ diff --git a/projects/project_activation_curve/data/WT_13.mat b/projects/project_activation_curve/data/WT_13.mat new file mode 100644 index 0000000..7800c93 Binary files /dev/null and b/projects/project_activation_curve/data/WT_13.mat differ diff --git a/projects/project_activation_curve/data/WT_14.mat b/projects/project_activation_curve/data/WT_14.mat new file mode 100644 index 0000000..0888e51 Binary files /dev/null and b/projects/project_activation_curve/data/WT_14.mat differ diff --git a/projects/project_activation_curve/data/WT_15.mat b/projects/project_activation_curve/data/WT_15.mat new file mode 100644 index 0000000..22a2c35 Binary files /dev/null and b/projects/project_activation_curve/data/WT_15.mat differ diff --git a/projects/project_activation_curve/data/WT_16.mat b/projects/project_activation_curve/data/WT_16.mat new file mode 100644 index 0000000..58790fa Binary files /dev/null and b/projects/project_activation_curve/data/WT_16.mat differ diff --git a/projects/project_activation_curve/data/WT_17.mat b/projects/project_activation_curve/data/WT_17.mat new file mode 100644 index 0000000..4ff049f Binary files /dev/null and b/projects/project_activation_curve/data/WT_17.mat differ diff --git a/projects/project_activation_curve/data/WT_18.mat b/projects/project_activation_curve/data/WT_18.mat new file mode 100644 index 0000000..1212310 Binary files /dev/null and b/projects/project_activation_curve/data/WT_18.mat differ diff --git a/projects/project_activation_curve/data/WT_19.mat b/projects/project_activation_curve/data/WT_19.mat new file mode 100644 index 0000000..ab8c804 Binary files /dev/null and b/projects/project_activation_curve/data/WT_19.mat differ diff --git a/projects/project_activation_curve/data/WT_20.mat b/projects/project_activation_curve/data/WT_20.mat new file mode 100644 index 0000000..0e7402d Binary files /dev/null and b/projects/project_activation_curve/data/WT_20.mat differ diff --git a/projects/project_activation_curve/data/WT_21.mat b/projects/project_activation_curve/data/WT_21.mat new file mode 100644 index 0000000..9980e32 Binary files /dev/null and b/projects/project_activation_curve/data/WT_21.mat differ diff --git a/projects/project_activation_curve/data/WT_22.mat b/projects/project_activation_curve/data/WT_22.mat new file mode 100644 index 0000000..6a4acfe Binary files /dev/null and b/projects/project_activation_curve/data/WT_22.mat differ diff --git a/projects/project_activation_curve/data/WT_23.mat b/projects/project_activation_curve/data/WT_23.mat new file mode 100644 index 0000000..2bb5953 Binary files /dev/null and b/projects/project_activation_curve/data/WT_23.mat differ diff --git a/projects/project_activation_curve/data/WT_24.mat b/projects/project_activation_curve/data/WT_24.mat new file mode 100644 index 0000000..2b14864 Binary files /dev/null and b/projects/project_activation_curve/data/WT_24.mat differ diff --git a/projects/project_activation_curve/data/WT_25.mat b/projects/project_activation_curve/data/WT_25.mat new file mode 100644 index 0000000..47a9f03 Binary files /dev/null and b/projects/project_activation_curve/data/WT_25.mat differ diff --git a/projects/project_activation_curve/data/WT_26.mat b/projects/project_activation_curve/data/WT_26.mat new file mode 100644 index 0000000..2441dcb Binary files /dev/null and b/projects/project_activation_curve/data/WT_26.mat differ diff --git a/projects/project_activation_curve/data/WT_27.mat b/projects/project_activation_curve/data/WT_27.mat new file mode 100644 index 0000000..d2e9bd5 Binary files /dev/null and b/projects/project_activation_curve/data/WT_27.mat differ diff --git a/projects/project_activation_curve/data/WT_28.mat b/projects/project_activation_curve/data/WT_28.mat new file mode 100644 index 0000000..dde6483 Binary files /dev/null and b/projects/project_activation_curve/data/WT_28.mat differ diff --git a/projects/project_activation_curve/data/WT_29.mat b/projects/project_activation_curve/data/WT_29.mat new file mode 100644 index 0000000..e4ce9f0 Binary files /dev/null and b/projects/project_activation_curve/data/WT_29.mat differ diff --git a/projects/project_shorttermpotentiation/Makefile b/projects/project_shorttermpotentiation/Makefile new file mode 100644 index 0000000..a7b3726 --- /dev/null +++ b/projects/project_shorttermpotentiation/Makefile @@ -0,0 +1,3 @@ +ZIPFILES= + +include ../project.mk diff --git a/projects/project_shorttermpotentiation/data/IV.mat b/projects/project_shorttermpotentiation/data/IV.mat new file mode 100644 index 0000000..6801545 Binary files /dev/null and b/projects/project_shorttermpotentiation/data/IV.mat differ diff --git a/projects/project_shorttermpotentiation/data/IV_steps.mat b/projects/project_shorttermpotentiation/data/IV_steps.mat new file mode 100644 index 0000000..b65beca Binary files /dev/null and b/projects/project_shorttermpotentiation/data/IV_steps.mat differ diff --git a/projects/project_shorttermpotentiation/data/STP.mat b/projects/project_shorttermpotentiation/data/STP.mat new file mode 100644 index 0000000..e0ab895 Binary files /dev/null and b/projects/project_shorttermpotentiation/data/STP.mat differ diff --git a/projects/project_shorttermpotentiation/rawData/IV.mat b/projects/project_shorttermpotentiation/rawData/IV.mat new file mode 100644 index 0000000..6801545 Binary files /dev/null and b/projects/project_shorttermpotentiation/rawData/IV.mat differ diff --git a/projects/project_shorttermpotentiation/rawData/IV_steps.mat b/projects/project_shorttermpotentiation/rawData/IV_steps.mat new file mode 100644 index 0000000..b65beca Binary files /dev/null and b/projects/project_shorttermpotentiation/rawData/IV_steps.mat differ diff --git a/projects/project_shorttermpotentiation/rawData/STP.mat b/projects/project_shorttermpotentiation/rawData/STP.mat new file mode 100644 index 0000000..e0ab895 Binary files /dev/null and b/projects/project_shorttermpotentiation/rawData/STP.mat differ diff --git a/projects/project_shorttermpotentiation/rawData/Username_2019-05-22_001.mat b/projects/project_shorttermpotentiation/rawData/Username_2019-05-22_001.mat new file mode 100644 index 0000000..1d5c230 Binary files /dev/null and b/projects/project_shorttermpotentiation/rawData/Username_2019-05-22_001.mat differ diff --git a/projects/project_shorttermpotentiation/rawData/main.m b/projects/project_shorttermpotentiation/rawData/main.m new file mode 100644 index 0000000..2925c87 --- /dev/null +++ b/projects/project_shorttermpotentiation/rawData/main.m @@ -0,0 +1,34 @@ +clear all +close all + +data = load('Username_2019-05-22_001.mat'); + +IV_protnum = [25]; +STP_protnum = [26, 27, 28, 29, 30]; + +IV = sortData(data, IV_protnum); +STP = sortData(data, STP_protnum); +IV_steps = -90:10:50; + +save 'IV.mat' IV +save 'IV_steps.mat' IV_steps +save 'STP.mat' STP + +% for i = 1:length(STP) +% for j = 1:length(STP{i}) +% figure(j) +% hold on +% plot(STP{i}{j}(:,1),STP{i}{j}(:,2)) +% hold off +% end +% end +% +% for i = 1:length(IV) +% for j = 1:length(IV{i}) +% figure(j) +% hold on +% plot(IV{i}{j}(:,1),IV{i}{j}(:,2)) +% hold off +% end +% end + diff --git a/projects/project_shorttermpotentiation/rawData/sortData.m b/projects/project_shorttermpotentiation/rawData/sortData.m new file mode 100644 index 0000000..a1b237f --- /dev/null +++ b/projects/project_shorttermpotentiation/rawData/sortData.m @@ -0,0 +1,20 @@ +function C = sortData(data, protnums) + +names = fieldnames(data); +C = cell(1,length(protnums)); + +for i = 1:length(protnums) + idxvec = zeros(1,length(names)); + for j = 1:length(names) + idxvec(j) = strcmp(names{j}(1:10), ['Trace_1_', num2str(protnums(i))]); + end + + c = cell(1,sum(idxvec)); + idxvec = find(idxvec); + for j = 1:length(idxvec) + c{j} = data.(names{idxvec(j)}); + end + C{i} = c; +end + + diff --git a/statistics/lecture/cumulative.py b/statistics/lecture/cumulative.py index a1cc849..5d9cedb 100644 --- a/statistics/lecture/cumulative.py +++ b/statistics/lecture/cumulative.py @@ -1,5 +1,6 @@ import numpy as np import matplotlib.pyplot as plt +from plotstyle import * # data: rng = np.random.RandomState(981) @@ -14,39 +15,31 @@ gauss = np.exp(-0.5*xx*xx)/np.sqrt(2.0*np.pi) gausscdf = np.cumsum(gauss)*dx # plot: -plt.xkcd() -fig = plt.figure( figsize=(6, 2.4) ) -ax = fig.add_subplot(1, 1, 1) -ax.spines['right'].set_visible(False) -ax.spines['top'].set_visible(False) -ax.yaxis.set_ticks_position('left') -ax.xaxis.set_ticks_position('bottom') -ax.set_xlabel( 'x' ) +fig, ax = plt.subplots() +ax.set_xlabel('x') ax.set_xlim(-3.2, 3.2) -ax.set_xticks( np.arange( -3.0, 3.1, 1.0 ) ) -ax.set_ylabel( 'F(x)' ) +ax.set_xticks(np.arange(-3.0, 3.1, 1.0)) +ax.set_ylabel('F(x)') ax.set_ylim(-0.05, 1.05) -ax.set_yticks( np.arange( 0.0, 1.1, 0.2 ) ) +ax.set_yticks(np.arange(0.0, 1.1, 0.2)) med = xs[cdf>=0.5][0] -ax.plot([-3.2, med, med], [0.5, 0.5, 0.0], 'k', lw=1, zorder=-5) +ax.plot([-3.2, med, med], [0.5, 0.5, 0.0], zorder=-5, **lsMarker) ax.text(-2.8, 0.55, 'F=0.5') ax.text(0.15, 0.25, 'median at %.2f' % med) q3 = xs[cdf>=0.75][0] -ax.plot([-3.2, q3, q3], [0.75, 0.75, 0.0], 'k', lw=1, zorder=-5) +ax.plot([-3.2, q3, q3], [0.75, 0.75, 0.0], zorder=-5, **lsMarker) ax.text(-2.8, 0.8, 'F=0.75') ax.text(0.8, 0.5, '3. quartile at %.2f' % q3) p = cdf[xs>=-1.0][0] -ax.plot([-3.2, -1.0, -1.0], [p, p, 0.0], 'k', lw=1, zorder=-5) +ax.plot([-3.2, -1.0, -1.0], [p, p, 0.0], zorder=-5, **lsMarker) ax.text(-2.8, 0.2, 'F=%.2f' % p) ax.text(-0.9, 0.05, '-1') -ax.plot(xx, gausscdf, '-', color='#0000ff', lw=2, zorder=-1) -ax.plot(xs, cdf, '-', color='#cc0000', lw=4, zorder=-1) -ax.plot([-3.2, 3.2], [1.0, 1.0], '--', color='k', lw=2, zorder=-10) +ax.plot(xx, gausscdf, zorder=-1, **lsAm) +ax.plot(xs, cdf, zorder=-1, **lsB) +ax.plot([-3.2, 3.2], [1.0, 1.0], zorder=-10, **lsGrid) -plt.subplots_adjust(left=0.1, right=0.98, bottom=0.15, top=0.98, wspace=0.35, hspace=0.3) -fig.savefig( 'cumulative.pdf' ) -#plt.show() +fig.savefig('cumulative.pdf') diff --git a/statistics/lecture/diehistograms.py b/statistics/lecture/diehistograms.py index 622d39b..57283a1 100644 --- a/statistics/lecture/diehistograms.py +++ b/statistics/lecture/diehistograms.py @@ -1,39 +1,30 @@ import numpy as np import matplotlib.pyplot as plt +from plotstyle import * # roll the die: rng = np.random.RandomState(57281) -x1 = rng.random_integers( 1, 6, 100 ) -x2 = rng.random_integers( 1, 6, 500 ) +x1 = rng.random_integers(1, 6, 100) +x2 = rng.random_integers(1, 6, 500) bins = np.arange(0.5, 7, 1.0) -plt.xkcd() +fig, (ax1, ax2) = plt.subplots(1, 2) +fig.subplots_adjust(**adjust_fs(bottom=2.7, top=0.1)) +ax1.set_xlim(0, 7) +ax1.set_xticks(range(1, 7)) +ax1.set_xlabel('x') +ax1.set_ylim(0, 98) +ax1.set_ylabel('Frequency') +fs = fsC +fs['color'] = [fsC['facecolor'], fsE['facecolor']] +del fs['facecolor'] +ax1.hist([x2, x1], bins, **fs) -fig = plt.figure( figsize=(6,3) ) -ax = fig.add_subplot( 1, 2, 1 ) -ax.spines['right'].set_visible(False) -ax.spines['top'].set_visible(False) -ax.yaxis.set_ticks_position('left') -ax.xaxis.set_ticks_position('bottom') -ax.set_xlim(0, 7) -ax.set_xticks( range(1, 7) ) -ax.set_xlabel( 'x' ) -ax.set_ylim(0, 98) -ax.set_ylabel( 'Frequency' ) -ax.hist([x2, x1], bins, color=['#FFCC00', '#FFFF66' ]) - -ax = fig.add_subplot( 1, 2, 2 ) -ax.spines['right'].set_visible(False) -ax.spines['top'].set_visible(False) -ax.yaxis.set_ticks_position('left') -ax.xaxis.set_ticks_position('bottom') -ax.set_xlim(0, 7) -ax.set_xticks( range(1, 7) ) -ax.set_xlabel( 'x' ) -ax.set_ylim(0, 0.23) -ax.set_ylabel( 'Probability' ) -ax.plot([0.2, 6.8], [1.0/6.0, 1.0/6.0], '-b', lw=2, zorder=1) -ax.hist([x2, x1], bins, normed=True, color=['#FFCC00', '#FFFF66' ], zorder=10) -plt.subplots_adjust(left=0.1, right=0.98, bottom=0.15, top=0.98, wspace=0.4, hspace=0.0) -fig.savefig( 'diehistograms.pdf' ) -#plt.show() +ax2.set_xlim(0, 7) +ax2.set_xticks(range(1, 7)) +ax2.set_xlabel('x') +ax2.set_ylim(0, 0.23) +ax2.set_ylabel('Probability') +ax2.plot([0.2, 6.8], [1.0/6.0, 1.0/6.0], zorder=1, **lsAm) +ax2.hist([x2, x1], bins, normed=True, zorder=10, **fs) +fig.savefig('diehistograms.pdf') diff --git a/statistics/lecture/displayunivariatedata.py b/statistics/lecture/displayunivariatedata.py index 97816f2..1eb36aa 100644 --- a/statistics/lecture/displayunivariatedata.py +++ b/statistics/lecture/displayunivariatedata.py @@ -1,33 +1,24 @@ import numpy as np import matplotlib.pyplot as plt +import matplotlib.gridspec as gridspec from scipy.stats import gaussian_kde +from plotstyle import * #rng = np.random.RandomState(981) #data = rng.randn(40, 1) + 4.0 rng = np.random.RandomState(1981) data = rng.gamma(1.0, 1.5, 40) + 1.0 data = data[data<7.5] -xpos = 0.08 -ypos = 0.15 -width = 0.65 -height = 0.8 barwidth = 0.8 scatterpos = 1.0 barpos = 2.5 boxpos = 4.0 -plt.xkcd() -fig = plt.figure( figsize=(6,3.4) ) +fig = plt.figure(figsize=cm_size(figure_width, 1.4*figure_height)) +spec = gridspec.GridSpec(nrows=1, ncols=2, width_ratios=[3, 1], wspace=0.1, + **adjust_fs(fig, left=4.0)) -ax = fig.add_axes([xpos, ypos, width, height]) -ax.spines['right'].set_visible(False) -ax.spines['top'].set_visible(False) -#ax.spines['left'].set_visible(False) -#ax.spines['bottom'].set_visible(False) -#ax.xaxis.set_ticks_position('none') -#ax.yaxis.set_ticks_position('none') -#ax.set_xticklabels([]) -#ax.set_yticklabels([]) +ax = fig.add_subplot(spec[0, 0]) wh = ax.boxplot( data, positions=[boxpos], widths=[barwidth], whis=100.0, patch_artist=True) wh['medians'][0].set_linewidth(4) wh['whiskers'][0].set_linewidth(2) @@ -49,7 +40,7 @@ ax.annotate('maximum', connectionstyle="angle3,angleA=0,angleB=120") ) ax.annotate('3. quartile', xy=(boxpos-0.3*barwidth, 3.7), xycoords='data', - xytext=(boxpos-1.3*barwidth, 5.5), textcoords='data', ha='left', + xytext=(boxpos-0.1*barwidth, 5.5), textcoords='data', ha='right', arrowprops=dict(arrowstyle="->", relpos=(0.4,0.0), connectionstyle="angle3,angleA=0,angleB=120") ) ax.annotate('median', @@ -57,19 +48,14 @@ ax.annotate('median', xytext=(boxpos+0.1*barwidth, 4.2), textcoords='data', ha='left', arrowprops=dict(arrowstyle="->", relpos=(0.8,0.0), connectionstyle="angle3,angleA=-60,angleB=20") ) - -ax = fig.add_axes([xpos, ypos, width, height]) -ax.spines['right'].set_visible(False) -ax.spines['top'].set_visible(False) -ax.yaxis.set_ticks_position('left') -ax.xaxis.set_ticks_position('bottom') ax.set_xticklabels([]) -ax.set_xlim(0.0, 4.8) -ax.set_ylabel('x') -ax.set_ylim( 0.0, 8.0) +ax = fig.add_subplot(spec[0, 0]) +ax.set_xlim(0.0, 4.8) ax.set_xticks([scatterpos, barpos, boxpos]) ax.set_xticklabels(['(1) data', '(2) bar\n plot', '(3) box-\nwhisker']) +ax.set_ylabel('x') +ax.set_ylim( 0.0, 8.0) # scatter data points according to their density: kernel = gaussian_kde(data) @@ -80,11 +66,10 @@ ax.scatter(scatterpos+barwidth*x*(rng.rand(len(data))-0.5), data, s=50) barmean = np.mean(data) barstd = np.std(data) ew = 0.2 -ax.bar([barpos-0.5*barwidth], [barmean], barwidth, color='#FFCC00') -eargs = {'color': 'k', 'lw': 2} -ax.plot([barpos, barpos], [barmean-barstd, barmean+barstd], **eargs) -ax.plot([barpos-0.5*ew, barpos+0.5*ew], [barmean-barstd, barmean-barstd], **eargs) -ax.plot([barpos-0.5*ew, barpos+0.5*ew], [barmean+barstd, barmean+barstd], **eargs) +ax.bar([barpos-0.5*barwidth], [barmean], barwidth, **fsC) +ax.plot([barpos, barpos], [barmean-barstd, barmean+barstd], **lsMarker) +ax.plot([barpos-0.5*ew, barpos+0.5*ew], [barmean-barstd, barmean-barstd], **lsMarker) +ax.plot([barpos-0.5*ew, barpos+0.5*ew], [barmean+barstd, barmean+barstd], **lsMarker) ax.annotate('mean', xy=(barpos-0.4*barwidth, 2.7), xycoords='data', xytext=(barpos-1*barwidth, 5.5), textcoords='data', ha='left', @@ -96,11 +81,7 @@ ax.annotate('mean plus\nstd. dev.', arrowprops=dict(arrowstyle="->", relpos=(0.5,0.0), connectionstyle="angle3,angleA=-60,angleB=80") ) -ax = fig.add_axes([xpos+width+0.03, ypos, 0.98-(xpos+width+0.03), height]) -ax.spines['right'].set_visible(False) -ax.spines['top'].set_visible(False) -ax.xaxis.set_ticks_position('bottom') -ax.yaxis.set_ticks_position('left') +ax = fig.add_subplot(spec[0, 1]) ax.set_yticklabels([]) ax.set_ylim( 0.0, 8.0) ax.set_xticks(np.arange(0.0, 0.4, 0.1)) @@ -108,8 +89,7 @@ ax.set_xlabel('(4) p(x)') bw = 0.75 bins = np.arange(0, 8.0+bw, bw) h, b = np.histogram(data, bins) -ax.barh(b[:-1], h/bw/np.sum(h), bw, color='#CC0000') +ax.barh(b[:-1], h/bw/np.sum(h), bw, **fsB) plt.savefig('displayunivariatedata.pdf') -#plt.show() diff --git a/statistics/lecture/median.py b/statistics/lecture/median.py index 8204688..da6fe40 100644 --- a/statistics/lecture/median.py +++ b/statistics/lecture/median.py @@ -1,78 +1,66 @@ import numpy as np import scipy.stats as st import matplotlib.pyplot as plt +from plotstyle import * # normal distribution: -x = np.arange( -3.0, 3.0, 0.01 ) +x = np.arange(-3.0, 3.0, 0.01) g = np.exp(-0.5*x*x)/np.sqrt(2.0*np.pi) -plt.xkcd() -fig = plt.figure( figsize=(6, 2.8) ) -ax = fig.add_subplot(1, 2, 1) -ax.spines['right'].set_visible(False) -ax.spines['top'].set_visible(False) -ax.yaxis.set_ticks_position('left') -ax.xaxis.set_ticks_position('bottom') -ax.set_xlabel( 'x' ) -ax.set_ylabel( 'Prob. density p(x)' ) -ax.set_ylim( 0.0, 0.46 ) -ax.set_yticks( np.arange( 0.0, 0.45, 0.1 ) ) -ax.text(-1.0, 0.06, '50%', ha='center' ) -ax.text(+1.0, 0.06, '50%', ha='center' ) -ax.annotate('Median\n= mean', +fig, (ax1, ax2) = plt.subplots(1, 2) +fig.subplots_adjust(**adjust_fs(bottom=2.7, top=0.1)) +ax1.set_xlabel('x') +ax1.set_ylabel('Prob. density p(x)') +ax1.set_ylim(0.0, 0.46) +ax1.set_yticks(np.arange(0.0, 0.45, 0.1)) +ax1.text(-1.0, 0.06, '50%', ha='center') +ax1.text(+1.0, 0.06, '50%', ha='center') +ax1.annotate('Median\n= mean', xy=(0.1, 0.3), xycoords='data', xytext=(1.2, 0.35), textcoords='data', ha='left', arrowprops=dict(arrowstyle="->", relpos=(0.0,0.2), - connectionstyle="angle3,angleA=10,angleB=40") ) -ax.annotate('Mode', + connectionstyle="angle3,angleA=10,angleB=40")) +ax1.annotate('Mode', xy=(-0.1, 0.4), xycoords='data', xytext=(-2.5, 0.43), textcoords='data', ha='left', arrowprops=dict(arrowstyle="->", relpos=(0.0,0.2), - connectionstyle="angle3,angleA=10,angleB=120") ) -ax.fill_between( x[x<0], 0.0, g[x<0], color='#ffcc00' ) -ax.fill_between( x[x>0], 0.0, g[x>0], color='#99ff00' ) -ax.plot(x, g, 'b', lw=4) -ax.plot([0.0, 0.0], [0.0, 0.45], 'k', lw=2 ) + connectionstyle="angle3,angleA=10,angleB=120")) +ax1.fill_between(x[x<0], 0.0, g[x<0], **fsCs) +ax1.fill_between(x[x>0], 0.0, g[x>0], **fsFs) +ax1.plot(x, g, **lsA) +ax1.plot([0.0, 0.0], [0.0, 0.45], **lsMarker) -# normal distribution: -x = np.arange( 0.0, 6.0, 0.01 ) +# gamma distribution: +x = np.arange(0.0, 6.0, 0.01) shape = 2.0 g = st.gamma.pdf(x, shape) m = st.gamma.median(shape) gm = st.gamma.mean(shape) -ax = fig.add_subplot(1, 2, 2) -ax.spines['right'].set_visible(False) -ax.spines['top'].set_visible(False) -ax.yaxis.set_ticks_position('left') -ax.xaxis.set_ticks_position('bottom') -ax.set_xlabel( 'x' ) -ax.set_ylabel( 'Prob. density p(x)' ) -ax.set_ylim( 0.0, 0.46 ) -ax.set_yticks( np.arange( 0.0, 0.45, 0.1 ) ) -ax.text(m-0.8, 0.06, '50%', ha='center' ) -ax.text(m+1.2, 0.06, '50%', ha='center' ) -ax.annotate('Median', +ax2.set_xlabel('x') +ax2.set_ylabel('Prob. density p(x)') +ax2.set_ylim(0.0, 0.46) +ax2.set_yticks(np.arange(0.0, 0.45, 0.1)) +ax2.text(m-0.8, 0.06, '50%', ha='center') +ax2.text(m+1.2, 0.06, '50%', ha='center') +ax2.annotate('Median', xy=(m+0.1, 0.2), xycoords='data', xytext=(m+1.6, 0.25), textcoords='data', ha='left', arrowprops=dict(arrowstyle="->", relpos=(0.0,0.5), - connectionstyle="angle3,angleA=30,angleB=70") ) -ax.annotate('Mean', + connectionstyle="angle3,angleA=30,angleB=70")) +ax2.annotate('Mean', xy=(gm, 0.01), xycoords='data', xytext=(gm+1.8, 0.15), textcoords='data', ha='left', arrowprops=dict(arrowstyle="->", relpos=(0.0,0.5), - connectionstyle="angle3,angleA=0,angleB=90") ) -ax.annotate('Mode', + connectionstyle="angle3,angleA=0,angleB=90")) +ax2.annotate('Mode', xy=(1.0, 0.38), xycoords='data', xytext=(1.8, 0.42), textcoords='data', ha='left', arrowprops=dict(arrowstyle="->", relpos=(0.0,0.5), - connectionstyle="angle3,angleA=0,angleB=70") ) -ax.fill_between( x[xm], 0.0, g[x>m], color='#99ff00' ) -ax.plot(x, g, 'b', lw=4) -ax.plot([m, m], [0.0, 0.38], 'k', lw=2 ) -#ax.plot([gm, gm], [0.0, 0.42], 'k', lw=2 ) + connectionstyle="angle3,angleA=0,angleB=70")) +ax2.fill_between(x[xm], 0.0, g[x>m], **fsFs) +ax2.plot(x, g, **lsA) +ax2.plot([m, m], [0.0, 0.38], **lsMarker) +#ax2.plot([gm, gm], [0.0, 0.38], **lsMarker) -#plt.tight_layout() -plt.subplots_adjust(left=0.1, right=0.98, bottom=0.15, top=0.98, wspace=0.4, hspace=0.0) -fig.savefig( 'median.pdf' ) -#plt.show() +fig.savefig('median.pdf') diff --git a/statistics/lecture/pdfhistogram.py b/statistics/lecture/pdfhistogram.py index e35606c..805e113 100644 --- a/statistics/lecture/pdfhistogram.py +++ b/statistics/lecture/pdfhistogram.py @@ -1,44 +1,31 @@ import numpy as np import matplotlib.pyplot as plt +from plotstyle import * # normal distribution: rng = np.random.RandomState(6281) -x = np.arange( -4.0, 4.0, 0.01 ) +x = np.arange(-4.0, 4.0, 0.01) g = np.exp(-0.5*x*x)/np.sqrt(2.0*np.pi) -r = rng.randn( 100 ) +r = rng.randn(100) -plt.xkcd() +fig, (ax1, ax2) = plt.subplots(1, 2) +ax1.set_xlabel('x') +ax1.set_xlim(-3.2, 3.2) +ax1.set_xticks(np.arange(-3.0, 3.1, 1.0)) +ax1.set_ylabel('Frequency') +ax1.set_yticks(np.arange(0.0, 41.0, 10.0)) +ax1.hist(r, 5, zorder=-10, **fsB) +ax1.hist(r, 20, zorder=-5, **fsC) -fig = plt.figure( figsize=(6,3) ) -ax = fig.add_subplot( 1, 2, 1 ) -ax.spines['right'].set_visible(False) -ax.spines['top'].set_visible(False) -ax.yaxis.set_ticks_position('left') -ax.xaxis.set_ticks_position('bottom') -ax.set_xlabel( 'x' ) -ax.set_xlim(-3.2, 3.2) -ax.set_xticks( np.arange( -3.0, 3.1, 1.0 ) ) -ax.set_ylabel( 'Frequency' ) -ax.set_yticks( np.arange( 0.0, 41.0, 10.0 ) ) -ax.hist(r, 5, color='#CC0000') -ax.hist(r, 20, color='#FFCC00') +ax2.set_xlabel('x') +ax2.set_xlim(-3.2, 3.2) +ax2.set_xticks(np.arange(-3.0, 3.1, 1.0)) +ax2.set_ylabel('Probab. density p(x)') +ax2.set_ylim(0.0, 0.44) +ax2.set_yticks(np.arange(0.0, 0.41, 0.1)) +ax2.plot(x, g, zorder=-1, **lsA) +ax2.hist(r, 5, normed=True, zorder=-10, **fsB) +ax2.hist(r, 20, normed=True, zorder=-5, **fsC) -ax = fig.add_subplot( 1, 2, 2 ) -ax.spines['right'].set_visible(False) -ax.spines['top'].set_visible(False) -ax.yaxis.set_ticks_position('left') -ax.xaxis.set_ticks_position('bottom') -ax.set_xlabel( 'x' ) -ax.set_xlim(-3.2, 3.2) -ax.set_xticks( np.arange( -3.0, 3.1, 1.0 ) ) -ax.set_ylabel( 'Probab. density p(x)' ) -ax.set_ylim(0.0, 0.44) -ax.set_yticks( np.arange( 0.0, 0.41, 0.1 ) ) -ax.plot(x, g, '-b', lw=2, zorder=-1) -ax.hist(r, 5, normed=True, color='#CC0000', zorder=-10) -ax.hist(r, 20, normed=True, color='#FFCC00', zorder=-5) - -plt.subplots_adjust(left=0.1, right=0.98, bottom=0.15, top=0.98, wspace=0.4, hspace=0.0) -fig.savefig( 'pdfhistogram.pdf' ) -#plt.show() +fig.savefig('pdfhistogram.pdf') diff --git a/statistics/lecture/pdfprobabilities.py b/statistics/lecture/pdfprobabilities.py index 10c4482..bafe13b 100644 --- a/statistics/lecture/pdfprobabilities.py +++ b/statistics/lecture/pdfprobabilities.py @@ -1,36 +1,28 @@ import numpy as np import matplotlib.pyplot as plt +from plotstyle import * # normal distribution: -x = np.arange( -3.0, 5.0, 0.01 ) +x = np.arange(-3.0, 5.0, 0.01) g = np.exp(-0.5*x*x)/np.sqrt(2.0*np.pi) x1=0.0 x2=1.0 -plt.xkcd() -fig = plt.figure( figsize=(6,3.4) ) -ax = fig.add_subplot( 1, 1, 1 ) -ax.spines['right'].set_visible(False) -ax.spines['top'].set_visible(False) -ax.yaxis.set_ticks_position('left') -ax.xaxis.set_ticks_position('bottom') -ax.set_xlabel( 'x' ) -ax.set_ylabel( 'Probability density p(x)' ) -ax.set_ylim( 0.0, 0.46 ) -ax.set_yticks( np.arange( 0.0, 0.45, 0.1 ) ) +fig, ax = plt.subplots() +ax.set_xlabel('x') +ax.set_ylabel('Probability density p(x)') +ax.set_ylim(0.0, 0.46) +ax.set_yticks(np.arange(0.0, 0.45, 0.1)) ax.annotate('Gaussian', xy=(-1.0, 0.28), xycoords='data', xytext=(-2.5, 0.35), textcoords='data', ha='left', arrowprops=dict(arrowstyle="->", relpos=(0.5,0.0), - connectionstyle="angle3,angleA=10,angleB=110") ) + connectionstyle="angle3,angleA=10,angleB=110")) ax.annotate('$P(0", relpos=(0.0,0.5), - connectionstyle="angle3,angleA=10,angleB=80") ) -ax.fill_between( x[(x>x1)&(xx1)&(xx1)&(xx1)&(x", relpos=(0.0,0.5), connectionstyle="angle3,angleA=10,angleB=40") ) -ax.fill_between( x[xq[0])&(xq[0])&(xq[1])&(xq[1])&(xq[2]], 0.0, g[x>q[2]], color='#ffff66' ) -ax.plot(x,g, 'b', lw=4) -ax.plot([0.0, 0.0], [0.0, 0.45], 'k', lw=2 ) -ax.plot([q[0], q[0]], [0.0, 0.4], 'k', lw=2 ) -ax.plot([q[2], q[2]], [0.0, 0.4], 'k', lw=2 ) -plt.subplots_adjust(left=0.1, right=0.98, bottom=0.15, top=0.98, wspace=0.4, hspace=0.0) -#plt.tight_layout() +ax.fill_between( x[xq[0])&(xq[0])&(xq[1])&(xq[1])&(xq[2]], 0.0, g[x>q[2]], **fsEs) +ax.plot(x,g, **lsA) +ax.plot([0.0, 0.0], [0.0, 0.45], **lsMarker) +ax.plot([q[0], q[0]], [0.0, 0.4], **lsMarker) +ax.plot([q[2], q[2]], [0.0, 0.4], **lsMarker) fig.savefig( 'quartile.pdf' ) -#plt.show()