-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest_run.py
More file actions
49 lines (42 loc) · 1.43 KB
/
test_run.py
File metadata and controls
49 lines (42 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#! /usr/bin/env python
# Load Libraries
import matplotlib as mpl
mpl.use('SVG')
import matplotlib.pyplot as plt
# %matplotlib inline
import seaborn as sns
sns.set(style='ticks',context='talk')
import bootstrap_contrast as bsc
import pandas as pd
import numpy as np
import scipy as sp
# Dummy dataset
dataset=list()
for seed in [10,11,12,13,14,15]:
np.random.seed(seed) # fix the seed so we get the same numbers each time.
dataset.append(np.random.randn(40))
df=pd.DataFrame(dataset).T
cols=['Control','Group1','Group2','Group3','Group4','Group5']
df.columns=cols
# Create some upwards/downwards shifts.
df['Group2']=df['Group2']-0.1
df['Group3']=df['Group3']+0.2
df['Group4']=(df['Group4']*1.1)+4
df['Group5']=(df['Group5']*1.1)-1
# Add gender column.
df['Gender']=np.concatenate([np.repeat('Male',20),np.repeat('Female',20)])
# bsc.__version__
f,c=bsc.contrastplot(data=df,
idx=(('Group1','Group3','Group2'),
('Control','Group4')),
color_col='Gender',
custom_palette={'Male':'blue',
'Female':'red'},
float_contrast=True,
swarm_label='my swarm',
contrast_label='contrast',
show_means='bars',
means_width=0.5,
show_std=True,
fig_size=(10,8))
f.savefig('testfig.svg',format='svg')