cov_all_stress = np.cov(points_all_stress)
cov_all_reg = np.cov(points_all_reg)
cov_all_stim = np.cov(points_all_stim)
mean_vec_all_stress = [np.nanmean(norm_ibi_all_stress_mean),np.nanmean(norm_pupil_all_stress_mean)]
mean_vec_all_reg = [np.nanmean(norm_ibi_all_reg_mean),np.nanmean(norm_pupil_all_reg_mean)]
mean_vec_all_stim = [np.nanmean(norm_ibi_all_stim_mean), np.nanmean(norm_pupil_all_stim_mean)]

cmap_stress = mpl.cm.autumn
cmap_reg = mpl.cm.winter
cmap_stim = mpl.cm.gray

plt.figure()
#plt.plot(ibi_all_stress_mean,pupil_all_stress_mean,'ro',label='Stress')
for i in range(0,len(ibi_all_stress_mean)):
    plt.plot(norm_ibi_all_stress_mean[i],norm_pupil_all_stress_mean[i],color=cmap_stress(i/float(len(ibi_all_stress_mean))),marker='o')
plot_cov_ellipse(cov_all_stress,mean_vec_all_stress,fc='r',ec='None',a=0.2)
#plt.plot(ibi_all_reg_before_mean,pupil_all_reg_before_mean,'bo',label='Reg Before')
for i in range(0,len(ibi_all_reg_mean)):
	plt.plot(norm_ibi_all_reg_mean[i],norm_pupil_all_reg_mean[i],color=cmap_reg(i/float(len(ibi_all_reg_mean))),marker='o')
plot_cov_ellipse(cov_all_reg,mean_vec_all_reg,fc='b',ec='None',a=0.2)
for i in range(0,len(ibi_all_stress_mean_stim)):
	plt.plot(norm_ibi_all_stim_mean[i],norm_pupil_all_stim_mean[i],color=cmap_stim(i/float(len(ibi_all_stress_mean_stim))),marker='o')
plot_cov_ellipse(cov_all_stim,mean_vec_all_stim,fc='k',ec='None',a=0.2)
#plt.legend()
plt.xlabel('Mean Trial IBI (s)')
plt.ylabel('Mean Trial PD (AU)')
plt.title('All Trials')
sm_reg = plt.cm.ScalarMappable(cmap=cmap_reg, norm=plt.Normalize(vmin=0, vmax=1))
# fake up the array of the scalar mappable. Urgh...
sm_reg._A = []
cbar = plt.colorbar(sm_reg,ticks=[0,1], orientation='vertical')
예제 #2
0
points_all_stress = np.array([norm_ibi_all_stress_mean,norm_pupil_all_stress_mean])
points_all_reg_before = np.array([norm_ibi_all_reg_before_mean,norm_pupil_all_reg_before_mean])
cov_all_stress = np.cov(points_all_stress)
cov_all_reg_before = np.cov(points_all_reg_before)
mean_vec_all_stress = [np.nanmean(norm_ibi_all_stress_mean),np.nanmean(norm_pupil_all_stress_mean)]
mean_vec_all_reg_before = [np.nanmean(norm_ibi_all_reg_before_mean),np.nanmean(norm_pupil_all_reg_before_mean)]

cmap_stress = mpl.cm.autumn
cmap_reg_before = mpl.cm.winter

plt.figure()
#plt.plot(ibi_all_stress_mean,pupil_all_stress_mean,'ro',label='Stress')
for i in range(0,len(ibi_all_stress_mean)):
    plt.plot(norm_ibi_all_stress_mean[i],norm_pupil_all_stress_mean[i],color=cmap_stress(i/float(len(ibi_all_stress_mean))),marker='o')
plot_cov_ellipse(cov_all_stress,mean_vec_all_stress,fc='r',ec='None',a=0.2)
#plt.plot(ibi_all_reg_before_mean,pupil_all_reg_before_mean,'bo',label='Reg Before')
for i in range(0,len(ibi_all_reg_before_mean)):
	plt.plot(norm_ibi_all_reg_before_mean[i],norm_pupil_all_reg_before_mean[i],color=cmap_reg_before(i/float(len(ibi_all_reg_before_mean))),marker='o')
plot_cov_ellipse(cov_all_reg_before,mean_vec_all_reg_before,fc='b',ec='None',a=0.2)
#plt.legend()
plt.xlabel('Mean Trial IBI (s)')
plt.ylabel('Mean Trial PD (AU)')
plt.title('All Trials')
sm_reg_before = plt.cm.ScalarMappable(cmap=cmap_reg_before, norm=plt.Normalize(vmin=0, vmax=1))
# fake up the array of the scalar mappable. Urgh...
sm_reg_before._A = []
cbar = plt.colorbar(sm_reg_before,ticks=[0,1], orientation='vertical')
cbar.ax.set_xticklabels(['Early', 'Late'])  # horizontal colorbar
sm_stress = plt.cm.ScalarMappable(cmap=cmap_stress, norm=plt.Normalize(vmin=0, vmax=1))
# fake up the array of the scalar mappable. Urgh...