def plot_summary(comb_corrs, targets, fig_path, extras=''): """ plot a summary showing the mean and std for all attempted combinations""" fig = plt.figure(figsize=(14, 12)) ax = plt.subplot(111) adjust_spines(ax, ['bottom', 'left']) colors = ['r', 'b', 'g', 'y', 'c', 'm'] _ = plt.subplot(111) xaxis = [] boxes = [] lbls = [] #targets.append('Overall') for i, [comb, vals] in enumerate(comb_corrs): xaxis.append(comb) offset = 0 for j, targ in enumerate(targets): dat = vals[targ] if len(dat) == 0: continue if targ == 'Overall': col = '0.3' else: col = colors[j] do_box_plot(np.array(dat), np.array([i + offset]), col, widths=[0.2]) #do_spot_scatter_plot(np.array(dat), np.array([i + offset]), col) offset += 0.3 if i == 0: boxes.append(plt.Rectangle((0, 0), 1, 1, fc=col)) lbls.append(targ) if j == 0: plt.title('N=%d' % len(dat)) plt.xticks(range(len(xaxis)), xaxis, rotation='vertical') plt.xlim(-1, len(xaxis) + 1) plt.plot([-1, len(xaxis) + 1], [0, 0], '--') plt.ylim(0, 1) plt.subplots_adjust(left=0.05, bottom=0.5, right=0.97, top=0.95, wspace=0.3, hspace=0.34) plt.legend(boxes, lbls, frameon=False, loc=4) plt.ylabel('Correlation between prediction and Experimental Mean') fname = '%s%s_pred_%s' % (fig_path, 'summary', extras) fig.savefig(fname + '.eps') fig.savefig(fname + '.png') #plt.show() plt.close(fig)
def plot_summary(comb_corrs, fig_path, extras=''): """ plot a summary showing the mean and std for all attempted combinations""" fig = plt.figure(figsize=(14, 12)) _ = plt.subplot(111) xaxis = [] boxes = [] lbls = [] for i, [comb, vals] in enumerate(comb_corrs): xaxis.append(comb) offset = 0 for [name, dat] in vals: if len(dat) == 0: continue if name == 'mask': col = 'r' elif name == 'surround': col = 'b' elif name == 'whole': col = 'g' elif name == 'overall': col = '0.3' do_box_plot(np.array(dat), np.array([i + offset]), col) offset += 0.15 if i == 0: boxes.append(plt.Rectangle((0, 0), 1, 1, fc=col)) lbls.append(name) plt.xticks(range(len(xaxis)), xaxis, rotation='vertical') plt.xlim(-1, len(xaxis) + 1) plt.subplots_adjust(left=0.05, bottom=0.5, right=0.97, top=0.95, wspace=0.3, hspace=0.34) plt.legend(boxes, lbls, frameon=False, loc=4) plt.ylabel('Correlation between prediction and Experimental Mean') fname = '%s%s_pred_%s' % (fig_path, 'summary', extras) fig.savefig(fname + '.eps') fig.savefig(fname + '.png') plt.show() plt.close(fig)
plt.ylim(-0.3, 1) plt.xlim(-1, len(x)) adjust_spines(ax, ['bottom', 'left']) plt.title('Whole vs Surround') plt.ylabel('Correlation Coef') plt.xlabel('Neuron #') ax = plt.subplot(414) plt.hold(True) plt.plot([-1, x[-1]], [0, 0], 'k--') xval = np.array([1]) lbls = [] tks = [] for i, exp_type in enumerate(exp_types): idx = cells[:, 0] == exp_type do_box_plot(corrs[idx, 0], xval, colors[i]) tks.append(xval[0]) lbls.append('Centre Vs Whole') if exp_type != 'PYR': xval += 1 plt.text(xval[0] - 0.25, -0.15, exp_type) do_box_plot(corrs[idx, 1], xval, colors[i]) tks.append(xval[0]) lbls.append('Centre Vs Surround') xval += 1 do_box_plot(corrs[idx, 2], xval, colors[i]) tks.append(xval[0]) lbls.append('Surround Vs Whole') xval += 2 else: plt.text(xval[0] - 0.25, -0.15, exp_type)