fig4S1.py 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. """Some, but not all Figure 4S1 plots, use run -i fig4S1.py. Companion to fig4.py.
  2. fig1.py and fig3.py contribute some plots to 4S1 as well"""
  3. mi = pd.MultiIndex.from_product([mvigrtmsustrs, STIMTYPES],
  4. names=['msu', 'stimtype'])
  5. fig4S1b = pd.DataFrame(index=mi, columns=['meanrate'])
  6. """Exporting all the various panels in fig4S1 to .csv is complicated.
  7. Mostly they come from elsewhere:
  8. a: maxFMI.csv : fig3.py
  9. b: fig4S1b.csv : fig4S1.py
  10. c--d: fig1.csv : fig1.py
  11. e--f: maxFMI.csv, also duplicated in fig4.csv : fig4.py
  12. g--l: left: fig1.csv; middle & right: fig3.csv : fig4S1.py
  13. """
  14. # fig4S1b: scatter plot best movie vs best grating mean firing rate, during control condition,
  15. # one point per msu:
  16. figsize = DEFAULTFIGURESIZE
  17. logmin, logmax = -1, 2
  18. logticks = np.array([-1, 0, 1, 2])
  19. mvivals, grtvals, exmplis, exmplmsustrs, normlis = [], [], [], [], []
  20. keptmsui = 0 # manually init and increment instead of using enumerate()
  21. for msustr in mvigrtmsustrs:
  22. try:
  23. mvival = bestmviresp['meanrate'][msustr, 'nat', 'none', False]
  24. grtval = bestgrtresp['meanrate'][msustr, 'none', False]
  25. except KeyError:
  26. continue # msustr doesn't exist in one of bestmviresp or bestgrtresp
  27. if pd.isna(mvival) or pd.isna(grtval): # missing one or both values
  28. continue
  29. mvivals.append(mvival)
  30. grtvals.append(grtval)
  31. # grt meanrate, meanrate02 and meanrate35 columns will all be identical:
  32. fig4S1b.loc[msustr, 'mvi']['meanrate'] = mvival # save
  33. fig4S1b.loc[msustr, 'grt']['meanrate'] = grtval # save
  34. if msustr in msu2exmpli:
  35. exmplis.append(keptmsui)
  36. exmplmsustrs.append(msustr)
  37. else:
  38. normlis.append(keptmsui)
  39. keptmsui += 1 # manually increment
  40. mvivals = np.asarray(mvivals)
  41. grtvals = np.asarray(grtvals)
  42. f, a = plt.subplots(figsize=figsize)
  43. wintitle('%s movie grating scatter %s %s' % ('meanrate', 'none', False))
  44. # plot y=x line:
  45. xyline = [10**logmin, 10**logmax], [10**logmin, 10**logmax]
  46. a.plot(xyline[0], xyline[1], '--', color='gray', zorder=-1)
  47. # plot normal (non-example) points:
  48. c = desat(st82clr['none'], opto2alpha[False]) # do manual alpha mixing
  49. a.scatter(grtvals[normlis], mvivals[normlis], clip_on=False,
  50. marker='.', c='None', edgecolor=c, s=DEFSZ)
  51. # plot example points, one at a time:
  52. for exmpli, msustr in zip(exmplis, exmplmsustrs):
  53. marker = exmpli2mrk[msu2exmpli[msustr]]
  54. c = exmpli2clr[msu2exmpli[msustr]]
  55. sz = exmpli2sz[msu2exmpli[msustr]]
  56. lw = exmpli2lw[msu2exmpli[msustr]]
  57. a.scatter(grtvals[exmpli], mvivals[exmpli], marker=marker, c=c, s=sz, lw=lw)
  58. # plot mean:
  59. #a.scatter(np.mean(grtvals), np.mean(mvivals),
  60. # c='red', edgecolor='red', s=50, marker='^')
  61. a.set_xlabel('Grating FR (spk/s)')
  62. a.set_ylabel('Movie FR (spk/s)')
  63. a.set_xscale('log')
  64. a.set_yscale('log')
  65. a.set_xlim(10**logmin, 10**logmax)
  66. a.set_ylim(10**logmin, 10**logmax)
  67. a.set_xticks(10.0**logticks)
  68. a.set_yticks(a.get_xticks()) # make log scale y ticks the same as x ticks
  69. a.minorticks_off()
  70. axes_disable_scientific(a)
  71. a.set_aspect('equal')
  72. a.spines['left'].set_position(('outward', 4))
  73. a.spines['bottom'].set_position(('outward', 4))
  74. #t, p = ttest_rel(grtvals, mvivals) # paired t-test
  75. #a.add_artist(AnchoredText('p$=$%.2g' % p, loc='upper left', frameon=False))
  76. # stripplot movie and grating mean firing rates during control condition, for all mseu:
  77. np.random.seed(0) # to get identical horizontal jitter in strip plots on every run
  78. figsize = DEFAULTFIGURESIZE
  79. logmin, logmax = -2, 2
  80. logticks = np.array([-2, -1, 0, 1, 2])
  81. mvivals, grtvals = [], []
  82. for mseustr in mvimseustrs:
  83. mvival = mviresp.loc[mseustr, 'nat', 'none', False]['meanrate']
  84. if pd.isna(mvival):
  85. continue
  86. mvivals.append(mvival)
  87. for mseustr in grtmseustrs:
  88. grtval = grtresp.loc[mseustr, 'none', False]['meanrate']
  89. if pd.isna(grtval):
  90. continue
  91. grtvals.append(grtval)
  92. mvivals = np.asarray(mvivals)
  93. grtvals = np.asarray(grtvals)
  94. f, a = plt.subplots(figsize=figsize)
  95. wintitle('%s movie grating stripplot %s %s' % ('meanrate', 'none', False))
  96. # plot y=0 line:
  97. a.axhline(y=0, ls='--', marker='', color='lightgray', zorder=-np.inf)
  98. data = pd.DataFrame.from_dict({'Movie':mvivals, 'Grating':grtvals},
  99. orient='index').transpose()
  100. sns.stripplot(ax=a, data=data, clip_on=False, marker='.',
  101. color='None', edgecolor='black', size=np.sqrt(50))
  102. # plot mean with short horizontal lines:
  103. #meanmvival, meangrtval = gmean(mvivals), gmean(grtvals)
  104. #a.plot([-0.25, 0.25], [meanmvival, meanmvival], '-', lw=2, c='red', zorder=np.inf)
  105. #a.plot([0.75, 1.25], [meangrtval, meangrtval], '-', lw=2, c='red', zorder=np.inf)
  106. a.set_ylabel('Firing rate (spk/s)')
  107. a.set_yscale('log')
  108. a.set_ylim(10**logmin, 10**logmax)
  109. a.set_yticks(10.0**logticks)
  110. a.tick_params(bottom=False)
  111. a.minorticks_off()
  112. axes_disable_scientific(a, axiss=[a.yaxis]) # don't do it on x axis, messes up x label
  113. a.spines['bottom'].set_position(('outward', 5))
  114. a.spines['bottom'].set_visible(False)
  115. # scatter plot blank movie meanrates:
  116. figsize = DEFAULTFIGURESIZE[0]*1.02, DEFAULTFIGURESIZE[1] # tweak to make space for log units
  117. logmin, logmax = -1.5, 2
  118. logticks = np.array([-1, 0, 1, 2])
  119. #log0min = logmin + 0.05
  120. for kind in ['nat']:#MVIKINDS:
  121. for st8 in ['none']:#ALLST8S:
  122. f, a = plt.subplots(figsize=figsize)
  123. wintitle('opto meanrate blank movie %s %s' % (kind, st8))
  124. rons, roffs, exmplis, exmplmseustrs, normlis = [], [], [], [], []
  125. keptmseui = 0 # manually init and increment instead of using enumerate()
  126. for mseustr in mvimseustrs:
  127. meanrate = mviresp.loc[mseustr, kind, st8]['blankmeanrate']
  128. snr = mviresp.loc[mseustr, kind, st8]['snr']
  129. if meanrate.isna().any(): # missing one or both meanrates
  130. continue
  131. if (snr < SNRTHRESH).all(): # neither condition has decent SNR
  132. continue
  133. rons.append(meanrate[True])
  134. roffs.append(meanrate[False])
  135. rates = mviresp.loc[mseustr, kind, st8]['blankrates']
  136. #_, pval = ttest_ind(rates[False], rates[True], equal_var=False)
  137. #sgnfs.append(pval < SCATTERPTHRESH) # bool
  138. fig1.loc[mseustr, 'blankmeanrate'] = meanrate[False], meanrate[True] # save
  139. fig1.loc[mseustr]['blankrates'] = rates # save trial-wise values
  140. if mvimseu2exmpli.get(mseustr) == fig1exmpli:
  141. exmplis.append(keptmseui)
  142. exmplmseustrs.append(mseustr)
  143. else:
  144. normlis.append(keptmseui)
  145. keptmseui += 1 # manually increment
  146. rons = np.asarray(rons)
  147. roffs = np.asarray(roffs)
  148. # plot y=x line:
  149. xyline = [10**logmin, 10**logmax], [10**logmin, 10**logmax]
  150. a.plot(xyline[0], xyline[1], '--', color='gray', zorder=-1)
  151. # plot normal (non-example) points:
  152. a.scatter(rons[normlis], roffs[normlis], clip_on=False,
  153. marker='.', c='None', edgecolor=st82clr[st8], s=DEFSZ)
  154. # plot example points, one at a time:
  155. for exmpli, mseustr in zip(exmplis, exmplmseustrs):
  156. marker = exmpli2mrk[mvimseu2exmpli[mseustr]]
  157. c = exmpli2clr[mvimseu2exmpli[mseustr]]
  158. sz = exmpli2sz[mvimseu2exmpli[mseustr]]
  159. lw = exmpli2lw[mvimseu2exmpli[mseustr]]
  160. a.scatter(rons[exmpli], roffs[exmpli], clip_on=False,
  161. marker=marker, c=c, s=sz, lw=lw)
  162. a.set_xlabel('Suppression FR (spk/s)')
  163. a.set_ylabel('Feedback FR (spk/s)')
  164. a.set_xscale('log')
  165. a.set_yscale('log')
  166. a.set_xlim(10**logmin, 10**logmax)
  167. a.set_ylim(10**logmin, 10**logmax)
  168. a.set_xticks(10.0**logticks)
  169. a.set_yticks(a.get_xticks()) # make log scale y ticks the same as x ticks
  170. a.minorticks_off()
  171. axes_disable_scientific(a)
  172. a.set_aspect('equal')
  173. a.spines['left'].set_position(('outward', 4))
  174. a.spines['bottom'].set_position(('outward', 4))
  175. #t, p = ttest_rel(rons, roffs) # paired t-test
  176. #a.add_artist(AnchoredText('p$=$%.2g' % p, loc='lower right', frameon=False))
  177. #mu = rons.mean(), roffs.mean()
  178. #txt = '$\mathregular{\mu=%.1f, %.1f}$' % mu
  179. #a.add_artist(AnchoredText(txt, loc='upper left', frameon=False))
  180. # scatter plot blank movie burst ratio:
  181. figsize = DEFAULTFIGURESIZE[0]*1.05, DEFAULTFIGURESIZE[1] # tweak to make space for log units
  182. logmin, logmax = -3, 0
  183. logticks = np.array([-3, -2, -1, 0])
  184. for kind in ['nat']:#MVIKINDS:
  185. for st8 in ['none']:#ALLST8S:
  186. f, a = plt.subplots(figsize=figsize)
  187. wintitle('opto burst ratio blank movie %s %s' % (kind, st8))
  188. brons, broffs, exmplis, exmplmseustrs, normlis = [], [], [], [], []
  189. keptmseui = 0 # manually init and increment instead of using enumerate()
  190. for mseustr in mvimseustrs:
  191. br = mviresp.loc[mseustr, kind, st8]['blankmeanburstratio']
  192. snr = mviresp.loc[mseustr, kind, st8]['snr']
  193. if br.isna().any(): # missing for at least one opto condition
  194. continue
  195. if (snr < SNRTHRESH).all(): # neither condition has decent SNR
  196. continue
  197. brons.append(br[True])
  198. broffs.append(br[False])
  199. burstratios = mviresp.loc[mseustr, kind, st8]['blankburstratios']
  200. #_, pval = ttest_ind(burstratios[False], burstratios[True], equal_var=False)
  201. #sgnfs.append(pval < SCATTERPTHRESH) # bool
  202. fig1.loc[mseustr, 'blankmeanburstratio'] = br[False], br[True] # save
  203. fig1.loc[mseustr]['blankburstratios'] = burstratios # save trial-wise values
  204. if mvimseu2exmpli.get(mseustr) == fig1exmpli:
  205. exmplis.append(keptmseui)
  206. exmplmseustrs.append(mseustr)
  207. else:
  208. normlis.append(keptmseui)
  209. keptmseui += 1 # manually increment
  210. brons, broffs = np.asarray(brons), np.asarray(broffs)
  211. # plot y=x line:
  212. xyline = [10**logmin, 10**logmax], [10**logmin, 10**logmax]
  213. a.plot(xyline[0], xyline[1], '--', color='gray', zorder=-1)
  214. # plot normal (non-example) points:
  215. a.scatter(brons[normlis], broffs[normlis], clip_on=True, # clip_on=False fails
  216. marker='.', c='None', edgecolor=st82clr[st8], s=DEFSZ)
  217. # plot example points, one at a time:
  218. for exmpli, mseustr in zip(exmplis, exmplmseustrs):
  219. marker = exmpli2mrk[mvimseu2exmpli[mseustr]]
  220. c = exmpli2clr[mvimseu2exmpli[mseustr]]
  221. sz = exmpli2sz[mvimseu2exmpli[mseustr]]
  222. lw = exmpli2lw[mvimseu2exmpli[mseustr]]
  223. a.scatter(brons[exmpli], broffs[exmpli], clip_on=True, # clip_on=False fails
  224. marker=marker, c=c, s=sz, lw=lw)
  225. a.set_xlabel('Suppression BR') # keep it short to maximize space for axes
  226. a.set_ylabel('Feedback BR')
  227. a.set_xscale('log')
  228. a.set_yscale('log')
  229. a.set_xlim(10**logmin, 10**logmax)
  230. a.set_ylim(10**logmin, 10**logmax)
  231. a.set_xticks(10.0**logticks)
  232. a.set_yticks(a.get_xticks()) # make log scale y ticks the same as x ticks
  233. a.minorticks_off()
  234. axes_disable_scientific(a)
  235. a.set_aspect('equal')
  236. a.spines['left'].set_position(('outward', 4))
  237. a.spines['bottom'].set_position(('outward', 4))
  238. #t, p = ttest_rel(brons, broffs) # paired t-test
  239. #a.add_artist(AnchoredText('p$=$%.2g' % p, loc='upper left', frameon=False))
  240. # scatter plot blank and blankcond grating meanrates:
  241. figsize = DEFAULTFIGURESIZE[0]*1.02, DEFAULTFIGURESIZE[1] # tweak to make space for log units
  242. logmin, logmax = -1.5, 2
  243. logticks = np.array([-1, 0, 1, 2])
  244. #log0min = logmin + 0.05
  245. for st8 in ['none']:#ALLST8S:
  246. for blnkname, blnksname in {'blankmeanrate':'blankrates',
  247. 'blankcondmeanrate':'blankcondrates'}.items():
  248. f, a = plt.subplots(figsize=figsize)
  249. wintitle('opto meanrate %s grating %s' % (blnkname, st8))
  250. rons, roffs, exmplis, exmplmseustrs, normlis = [], [], [], [], []
  251. keptmseui = 0 # manually init and increment instead of using enumerate()
  252. for mseustr in grtmseustrs:
  253. trialis = grtresp.loc[mseustr, st8]['trialis'] # non-blank & blank trialis
  254. if trialis.isna().any(): # missing for at least one opto condition
  255. continue
  256. ntrials = { opto:len(trialis[opto]) for opto in OPTOS } # should be equal
  257. blnkratesfull = pd.Series({ opto:np.full(ntrials[opto], np.nan) # pad
  258. for opto in [False, True] })
  259. meanrate = grtresp.loc[mseustr, st8][blnkname]
  260. if meanrate.isna().any(): # missing for at least one opto condition, can't plot
  261. fig3.loc[mseustr][blnksname] = blnkbrsfull # save nans for all trials
  262. continue
  263. rons.append(meanrate[True])
  264. roffs.append(meanrate[False])
  265. rates = grtresp.loc[mseustr, st8]['rates'] # trial-wise
  266. nnblnktrials = { opto:len(rates[opto]) for opto in OPTOS } # num non-blank trials
  267. blnkrates = grtresp.loc[mseustr, st8][blnksname]
  268. if blnksname == 'blankrates':
  269. for opto in OPTOS:
  270. blnkratesfull[opto][:nnblnktrials[opto]] = blnkrates[opto]
  271. else: # blnksname == 'blankcondrates':
  272. for opto in OPTOS:
  273. blnkratesfull[opto][nnblnktrials[opto]:] = blnkrates[opto]
  274. fig3.loc[mseustr, blnkname] = meanrate[False], meanrate[True] # save
  275. fig3.loc[mseustr][blnksname] = blnkratesfull # save padded trial-wise values
  276. if mseustr in grtmseu2exmpli:
  277. exmplis.append(keptmseui)
  278. exmplmseustrs.append(mseustr)
  279. else:
  280. normlis.append(keptmseui)
  281. keptmseui += 1 # manually increment
  282. rons = np.asarray(rons)
  283. roffs = np.asarray(roffs)
  284. # plot y=x line:
  285. xyline = [10**logmin, 10**logmax], [10**logmin, 10**logmax]
  286. a.plot(xyline[0], xyline[1], '--', color='gray', zorder=-1)
  287. # plot normal (non-example) points:
  288. a.scatter(rons[normlis], roffs[normlis], clip_on=True, # fails
  289. marker='.', c='None', edgecolor=st82clr[st8], s=DEFSZ)
  290. # plot example points, one at a time:
  291. for exmpli, mseustr in zip(exmplis, exmplmseustrs):
  292. marker = exmpli2mrk[grtmseu2exmpli[mseustr]]
  293. c = exmpli2clr[grtmseu2exmpli[mseustr]]
  294. sz = exmpli2sz[grtmseu2exmpli[mseustr]]
  295. lw = exmpli2lw[grtmseu2exmpli[mseustr]]
  296. a.scatter(rons[exmpli], roffs[exmpli], clip_on=False,
  297. marker=marker, c=c, s=sz, lw=lw)
  298. a.set_xlabel('Suppression FR (spk/s)')
  299. a.set_ylabel('Feedback FR (spk/s)')
  300. a.set_xscale('log')
  301. a.set_yscale('log')
  302. a.set_xlim(10**logmin, 10**logmax)
  303. a.set_ylim(10**logmin, 10**logmax)
  304. a.set_xticks(10.0**logticks)
  305. a.set_yticks(a.get_xticks()) # make log scale y ticks the same as x ticks
  306. a.minorticks_off()
  307. axes_disable_scientific(a)
  308. a.set_aspect('equal')
  309. a.spines['left'].set_position(('outward', 4))
  310. a.spines['bottom'].set_position(('outward', 4))
  311. #t, p = ttest_rel(rons, roffs) # paired t-test
  312. #a.add_artist(AnchoredText('p$=$%.2g' % p, loc='lower right', frameon=False))
  313. #mu = rons.mean(), roffs.mean()
  314. #txt = '$\mathregular{\mu=%.1f, %.1f}$' % mu
  315. #a.add_artist(AnchoredText(txt, loc='upper left', frameon=False))
  316. # scatter plot blank and blank cond grating burst ratio:
  317. figsize = DEFAULTFIGURESIZE[0]*1.05, DEFAULTFIGURESIZE[1] # tweak to make space for log units
  318. logmin, logmax = -3, 0
  319. logticks = np.array([-3, -2, -1, 0])
  320. for st8 in ['none']:#ALLST8S:
  321. for blnkname, blnksname in {'blankmeanburstratio':'blankburstratios',
  322. 'blankcondmeanburstratio':'blankcondburstratios'}.items():
  323. f, a = plt.subplots(figsize=figsize)
  324. wintitle('opto burst ratio %s grating %s' % (blnkname, st8))
  325. brons, broffs, exmplis, exmplmseustrs, normlis = [], [], [], [], []
  326. keptmseui = 0 # manually init and increment instead of using enumerate()
  327. for mseustr in grtmseustrs:
  328. trialis = grtresp.loc[mseustr, st8]['trialis'] # non-blank & blank trialis
  329. if trialis.isna().any(): # missing for at least one opto condition
  330. continue
  331. ntrials = { opto:len(trialis[opto]) for opto in OPTOS } # should be equal
  332. blnkbrsfull = pd.Series({ opto:np.full(ntrials[opto], np.nan) # pad
  333. for opto in [False, True] })
  334. br = grtresp.loc[mseustr, st8][blnkname] # mean BR
  335. if br.isna().any(): # missing for at least one opto condition, can't plot
  336. fig3.loc[mseustr][blnksname] = blnkbrsfull # save nans for all trials
  337. continue
  338. brons.append(br[True])
  339. broffs.append(br[False])
  340. burstratios = grtresp.loc[mseustr, st8]['burstratios'] # trial-wise
  341. nnblnktrials = { opto:len(burstratios[opto]) for opto in OPTOS } # num non-blank trials
  342. blnkbrs = grtresp.loc[mseustr, st8][blnksname]
  343. if blnksname == 'blankburstratios':
  344. for opto in OPTOS:
  345. blnkbrsfull[opto][:nnblnktrials[opto]] = blnkbrs[opto]
  346. else: # blnksname == 'blankcondburstratios':
  347. for opto in OPTOS:
  348. blnkbrsfull[opto][nnblnktrials[opto]:] = blnkbrs[opto]
  349. fig3.loc[mseustr, blnkname] = br[False], br[True] # save
  350. fig3.loc[mseustr][blnksname] = blnkbrsfull # save padded trial-wise values
  351. if mseustr in grtmseu2exmpli:
  352. exmplis.append(keptmseui)
  353. exmplmseustrs.append(mseustr)
  354. else:
  355. normlis.append(keptmseui)
  356. keptmseui += 1 # manually increment
  357. brons, broffs = np.asarray(brons), np.asarray(broffs)
  358. # plot y=x line:
  359. xyline = [10**logmin, 10**logmax], [10**logmin, 10**logmax]
  360. a.plot(xyline[0], xyline[1], '--', color='gray', zorder=-1)
  361. # plot normal (non-example) points:
  362. a.scatter(brons[normlis], broffs[normlis], clip_on=True, # clip_on=False fails
  363. marker='.', c='None', edgecolor=st82clr[st8], s=DEFSZ)
  364. # plot example points, one at a time:
  365. for exmpli, mseustr in zip(exmplis, exmplmseustrs):
  366. marker = exmpli2mrk[grtmseu2exmpli[mseustr]]
  367. c = exmpli2clr[grtmseu2exmpli[mseustr]]
  368. sz = exmpli2sz[grtmseu2exmpli[mseustr]]
  369. lw = exmpli2lw[grtmseu2exmpli[mseustr]]
  370. a.scatter(brons[exmpli], broffs[exmpli], clip_on=True, # clip_on=False fails
  371. marker=marker, c=c, s=sz, lw=lw)
  372. a.set_xlabel('Suppression BR') # keep it short to maximize space for axes
  373. a.set_ylabel('Feedback BR')
  374. a.set_xscale('log')
  375. a.set_yscale('log')
  376. a.set_xlim(10**logmin, 10**logmax)
  377. a.set_ylim(10**logmin, 10**logmax)
  378. a.set_xticks(10.0**logticks)
  379. a.set_yticks(a.get_xticks()) # make log scale y ticks the same as x ticks
  380. a.minorticks_off()
  381. axes_disable_scientific(a)
  382. a.set_aspect('equal')
  383. a.spines['left'].set_position(('outward', 4))
  384. a.spines['bottom'].set_position(('outward', 4))
  385. #t, p = ttest_rel(brons, broffs) # paired t-test
  386. #a.add_artist(AnchoredText('p$=$%.2g' % p, loc='upper left', frameon=False))