Merge branch 'master' of https://whale.am28.uni-tuebingen.de/git/teaching/scientificComputing
This commit is contained in:
commit
d1c8112030
164
plotstyle.py
164
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__
|
||||
|
@ -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
|
3
projects/project_activation_curve/Makefile
Normal file
3
projects/project_activation_curve/Makefile
Normal file
@ -0,0 +1,3 @@
|
||||
ZIPFILES=
|
||||
|
||||
include ../project.mk
|
BIN
projects/project_activation_curve/data/A1622D_01.mat
Normal file
BIN
projects/project_activation_curve/data/A1622D_01.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/A1622D_02.mat
Normal file
BIN
projects/project_activation_curve/data/A1622D_02.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/A1622D_03.mat
Normal file
BIN
projects/project_activation_curve/data/A1622D_03.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/A1622D_04.mat
Normal file
BIN
projects/project_activation_curve/data/A1622D_04.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/A1622D_05.mat
Normal file
BIN
projects/project_activation_curve/data/A1622D_05.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/A1622D_06.mat
Normal file
BIN
projects/project_activation_curve/data/A1622D_06.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/A1622D_07.mat
Normal file
BIN
projects/project_activation_curve/data/A1622D_07.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/A1622D_08.mat
Normal file
BIN
projects/project_activation_curve/data/A1622D_08.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/A1622D_09.mat
Normal file
BIN
projects/project_activation_curve/data/A1622D_09.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/A1622D_10.mat
Normal file
BIN
projects/project_activation_curve/data/A1622D_10.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/A1622D_11.mat
Normal file
BIN
projects/project_activation_curve/data/A1622D_11.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/A1622D_12.mat
Normal file
BIN
projects/project_activation_curve/data/A1622D_12.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/A1622D_13.mat
Normal file
BIN
projects/project_activation_curve/data/A1622D_13.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/A1622D_14.mat
Normal file
BIN
projects/project_activation_curve/data/A1622D_14.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/A1622D_15.mat
Normal file
BIN
projects/project_activation_curve/data/A1622D_15.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/A1622D_16.mat
Normal file
BIN
projects/project_activation_curve/data/A1622D_16.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/A1622D_17.mat
Normal file
BIN
projects/project_activation_curve/data/A1622D_17.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_01.mat
Normal file
BIN
projects/project_activation_curve/data/WT_01.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_02.mat
Normal file
BIN
projects/project_activation_curve/data/WT_02.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_03.mat
Normal file
BIN
projects/project_activation_curve/data/WT_03.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_04.mat
Normal file
BIN
projects/project_activation_curve/data/WT_04.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_05.mat
Normal file
BIN
projects/project_activation_curve/data/WT_05.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_06.mat
Normal file
BIN
projects/project_activation_curve/data/WT_06.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_07.mat
Normal file
BIN
projects/project_activation_curve/data/WT_07.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_08.mat
Normal file
BIN
projects/project_activation_curve/data/WT_08.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_09.mat
Normal file
BIN
projects/project_activation_curve/data/WT_09.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_10.mat
Normal file
BIN
projects/project_activation_curve/data/WT_10.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_11.mat
Normal file
BIN
projects/project_activation_curve/data/WT_11.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_12.mat
Normal file
BIN
projects/project_activation_curve/data/WT_12.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_13.mat
Normal file
BIN
projects/project_activation_curve/data/WT_13.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_14.mat
Normal file
BIN
projects/project_activation_curve/data/WT_14.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_15.mat
Normal file
BIN
projects/project_activation_curve/data/WT_15.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_16.mat
Normal file
BIN
projects/project_activation_curve/data/WT_16.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_17.mat
Normal file
BIN
projects/project_activation_curve/data/WT_17.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_18.mat
Normal file
BIN
projects/project_activation_curve/data/WT_18.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_19.mat
Normal file
BIN
projects/project_activation_curve/data/WT_19.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_20.mat
Normal file
BIN
projects/project_activation_curve/data/WT_20.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_21.mat
Normal file
BIN
projects/project_activation_curve/data/WT_21.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_22.mat
Normal file
BIN
projects/project_activation_curve/data/WT_22.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_23.mat
Normal file
BIN
projects/project_activation_curve/data/WT_23.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_24.mat
Normal file
BIN
projects/project_activation_curve/data/WT_24.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_25.mat
Normal file
BIN
projects/project_activation_curve/data/WT_25.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_26.mat
Normal file
BIN
projects/project_activation_curve/data/WT_26.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_27.mat
Normal file
BIN
projects/project_activation_curve/data/WT_27.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_28.mat
Normal file
BIN
projects/project_activation_curve/data/WT_28.mat
Normal file
Binary file not shown.
BIN
projects/project_activation_curve/data/WT_29.mat
Normal file
BIN
projects/project_activation_curve/data/WT_29.mat
Normal file
Binary file not shown.
3
projects/project_shorttermpotentiation/Makefile
Normal file
3
projects/project_shorttermpotentiation/Makefile
Normal file
@ -0,0 +1,3 @@
|
||||
ZIPFILES=
|
||||
|
||||
include ../project.mk
|
BIN
projects/project_shorttermpotentiation/data/IV.mat
Normal file
BIN
projects/project_shorttermpotentiation/data/IV.mat
Normal file
Binary file not shown.
BIN
projects/project_shorttermpotentiation/data/IV_steps.mat
Normal file
BIN
projects/project_shorttermpotentiation/data/IV_steps.mat
Normal file
Binary file not shown.
BIN
projects/project_shorttermpotentiation/data/STP.mat
Normal file
BIN
projects/project_shorttermpotentiation/data/STP.mat
Normal file
Binary file not shown.
BIN
projects/project_shorttermpotentiation/rawData/IV.mat
Normal file
BIN
projects/project_shorttermpotentiation/rawData/IV.mat
Normal file
Binary file not shown.
BIN
projects/project_shorttermpotentiation/rawData/IV_steps.mat
Normal file
BIN
projects/project_shorttermpotentiation/rawData/IV_steps.mat
Normal file
Binary file not shown.
BIN
projects/project_shorttermpotentiation/rawData/STP.mat
Normal file
BIN
projects/project_shorttermpotentiation/rawData/STP.mat
Normal file
Binary file not shown.
Binary file not shown.
34
projects/project_shorttermpotentiation/rawData/main.m
Normal file
34
projects/project_shorttermpotentiation/rawData/main.m
Normal file
@ -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
|
||||
|
20
projects/project_shorttermpotentiation/rawData/sortData.m
Normal file
20
projects/project_shorttermpotentiation/rawData/sortData.m
Normal file
@ -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
|
||||
|
||||
|
@ -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')
|
||||
|
@ -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')
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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[x<m], 0.0, g[x<m], color='#ffcc00' )
|
||||
ax.fill_between( x[x>m], 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[x<m], 0.0, g[x<m], **fsCs)
|
||||
ax2.fill_between(x[x>m], 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')
|
||||
|
@ -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')
|
||||
|
||||
|
@ -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<x<1) = \int_0^1 p(x) \, dx$',
|
||||
xy=(0.6, 0.28), xycoords='data',
|
||||
xy=(0.5, 0.24), xycoords='data',
|
||||
xytext=(1.2, 0.4), textcoords='data', ha='left',
|
||||
arrowprops=dict(arrowstyle="->", relpos=(0.0,0.5),
|
||||
connectionstyle="angle3,angleA=10,angleB=80") )
|
||||
ax.fill_between( x[(x>x1)&(x<x2)], 0.0, g[(x>x1)&(x<x2)], color='#cc0000' )
|
||||
ax.plot(x,g, 'b', lw=4)
|
||||
#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( 'pdfprobabilities.pdf' )
|
||||
#plt.show()
|
||||
connectionstyle="angle3,angleA=10,angleB=80"))
|
||||
ax.fill_between(x[(x>x1)&(x<x2)], 0.0, g[(x>x1)&(x<x2)], **fsBs)
|
||||
ax.plot(x,g, **lsA)
|
||||
fig.savefig('pdfprobabilities.pdf')
|
||||
|
@ -1,22 +1,18 @@
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
from plotstyle import *
|
||||
|
||||
# normal distribution:
|
||||
x = np.arange( -4.0, 4.0, 0.01 )
|
||||
g = np.exp(-0.5*x*x)/np.sqrt(2.0*np.pi)
|
||||
q = [ -0.67488, 0.0, 0.67488 ]
|
||||
|
||||
plt.xkcd()
|
||||
fig = plt.figure( figsize=(6,3.2) )
|
||||
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(figsize=cm_size(figure_width, 1.2*figure_height))
|
||||
fig.subplots_adjust(**adjust_fs(bottom=2.7, top=0.1))
|
||||
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.text(-1.2, 0.1, '25%', ha='center' )
|
||||
ax.text(-0.35, 0.1, '25%', ha='center' )
|
||||
ax.text(+0.35, 0.1, '25%', ha='center' )
|
||||
@ -36,15 +32,12 @@ ax.annotate('Median',
|
||||
xytext=(1.6, 0.35), textcoords='data', ha='left',
|
||||
arrowprops=dict(arrowstyle="->", relpos=(0.0,0.5),
|
||||
connectionstyle="angle3,angleA=10,angleB=40") )
|
||||
ax.fill_between( x[x<q[0]], 0.0, g[x<q[0]], color='#ffcc00' )
|
||||
ax.fill_between( x[(x>q[0])&(x<q[1])], 0.0, g[(x>q[0])&(x<q[1])], color='#ff0000' )
|
||||
ax.fill_between( x[(x>q[1])&(x<q[2])], 0.0, g[(x>q[1])&(x<q[2])], color='#ff9900' )
|
||||
ax.fill_between( x[x>q[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[x<q[0]], 0.0, g[x<q[0]], **fsCs)
|
||||
ax.fill_between( x[(x>q[0])&(x<q[1])], 0.0, g[(x>q[0])&(x<q[1])], **fsBs)
|
||||
ax.fill_between( x[(x>q[1])&(x<q[2])], 0.0, g[(x>q[1])&(x<q[2])], **fsDs)
|
||||
ax.fill_between( x[x>q[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()
|
||||
|
Reference in New Issue
Block a user