-
Notifications
You must be signed in to change notification settings - Fork 1
/
plot_mfr.py
27 lines (25 loc) · 1.03 KB
/
plot_mfr.py
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
import pandas
import seaborn as sns
import matplotlib
import matplotlib.pyplot as plt
from statannot import add_stat_annotation
data = pandas.read_csv( 'results/mfr.csv' )
print( data )
sns.set( style='darkgrid' )
matplotlib.rcParams[ 'axes.titlesize' ] = 'large'
matplotlib.rcParams[ 'axes.labelsize' ] = 'large'
# For each cluster i
for i in range( 2 ):
fig, axs = plt.subplots( ncols=1, figsize=(6,3) )
axs.set_title( 'Cluster %d' % (i+1) )
df = data[ data['Cluster']==i ]
sns.barplot( ax=axs, x='Region', y='MFR [Hz]', hue='Condition', data=df )
box_pairs = [((x, 'healthy'), (x, 'pd')) for x in df['Region'].unique()]
print( box_pairs )
test_results = add_stat_annotation( axs, data=df, x='Region', y='MFR [Hz]', hue='Condition',
box_pairs=box_pairs,
test='t-test_paired', text_format='star',
loc='inside', verbose=2 )
plt.tight_layout()
plt.savefig( 'results/mfr_%d.pdf' % i )
plt.clf()