-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathsup_figure_7.py
57 lines (34 loc) · 1.38 KB
/
sup_figure_7.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import moss
from plotutils import set_style, savefig, get_subject_order
def setup_figure():
f, axes = plt.subplots(1, 6, figsize=(6, 2))
return f, axes
def plot_time_corrs(subjects, axes):
x = np.arange(1, 5)
palette = [".2", ".5"]
for subj, ax in zip(subjects, axes):
res_fname = "correlation_analysis/{}_rest_ifs.pkz".format(subj)
res = moss.load_pkl(res_fname)
for line, color in zip(res.corr_times.T, palette):
ax.plot(x, line, "o-", color=color, ms=3, clip_on=False)
sig = res.corr_times_pctiles > 95
ax.plot(x[sig], np.ones(sig.sum()) * .0025,
marker=(6, 2, 0), ls="", mew=.35, mec=".2", ms=3)
ax.set(xticks=x, xlim=(.6, 4.4), ylim=(0, .07))
sns.despine(ax=ax, trim=True)
plt.setp(axes[1:], yticklabels=[])
axes[0].set_ylabel("Correlation (r)")
if __name__ == "__main__":
set_style()
f, axes = setup_figure()
subjects = get_subject_order("sticks")
plot_time_corrs(subjects, axes)
axes[0].text(2.5, .041, "Same context", color=".2", size=7, ha="center")
axes[0].text(2.9, .014, "Different\ncontext", color=".5", size=7, ha="center")
f.text(.55, .03, "Resting scan number", size=10, ha="center")
f.tight_layout()
f.subplots_adjust(bottom=.2)
savefig(f, __file__)