def plot_z_each(data, ans, names, sf_filepath, title, save_path, xrange=None, yrange=None): data_list = results_list(data, ans, names) data_list.classify(sf_filepath) # the number of the classes == 11 fig, ax = plt.subplots(3, 3, figsize=(24,24)) ax[0][0].set_title('All', fontsize=20) if xrange is not None: for i in range(0,9): ax[i//3][i%3].set_xlim(xrange[0], xrange[1]) if yrange is not None: for i in range(0,9): ax[i//3][i%3].set_ylim(yrange[0], yrange[1]) idxs, labels, colors, markers = ans2index_label_color_marker(ans) for i, (label, color, marker) in enumerate(zip(labels,colors,markers)): ax[0][0].scatter(data[0,idxs[i]:idxs[i+1]], data[1,idxs[i]:idxs[i+1]], label=label, s=20, color=color, marker=marker) ax[0][0].legend() ax[0][0].set_title(title, fontsize=20) for i, (result, label, color) in enumerate(zip(data_list,labels,colors)): if len(result.success) > 0: ax[(i+1)//3][(i+1)%3].scatter(result.success[:,0], result.success[:,1], label=label, s=20, color=color, marker='.') if len(result.false) > 0: ax[(i+1)//3][(i+1)%3].scatter(result.false[:,0], result.false[:,1], label=label, s=20, color=color, marker='x') ax[(i+1)//3][(i+1)%3].set_title('Player '+label, fontsize=20) #ax[(i+1)//3][(i+1)%3].legend() plt.tight_layout() plt.savefig(save_path) plt.close()
def plot_z_each(self, z, ans, score, names, sf_filepath, title, save_path): data_list = results_list(z, ans, names) data_list.classify(sf_filepath) # the number of the classes == 11 fig, ax = plt.subplots(3, 3, figsize=(24, 24)) ax[0][0].set_title('All', fontsize=20) if mesh_z is not None: z_xrange = [ np.min([np.min(z[0]), np.min(mesh_z[0])]), np.max([np.max(z[0]), np.max(mesh_z[0])]) ] z_xrange = [ np.min([np.min(z[1]), np.min(mesh_z[1])]), np.max([np.max(z[1]), np.max(mesh_z[1])]) ] z_xrange = [np.min(z[0]), np.max(z[0])] z_yrange = [np.min(z[1]), np.max(z[1])] for i in range(0, 9): ax[i // 3][i % 3].set_xlim(z_xrange[0], z_xrange[1]) ax[i // 3][i % 3].set_ylim(z_yrange[0], z_yrange[1]) if mesh_z is not None: idxs, labels, colors, markers = ans_score2index_label_color_marker( mesh_ans, score) for i, (label, color, marker) in enumerate(zip(labels, colors, markers)): ax[0][0].scatter(mesh_z[0, idxs[i]:idxs[i + 1]], mesh_z[1, idxs[i]:idxs[i + 1]], alpha=0.3, color=color, marker="o") idxs, labels, colors, markers = ans_score2index_label_color_marker( ans, score) for i, (label, color, marker) in enumerate(zip(labels, colors, markers)): ax[0][0].scatter(data[0, idxs[i]:idxs[i + 1]], data[1, idxs[i]:idxs[i + 1]], label=label, s=20, color=color, marker=marker) ax[0][0].legend() ax[0][0].set_title(title, fontsize=20) for i, (result, label, color) in enumerate(zip(data_list, labels, colors)): if len(result.success) > 0: ax[(i + 1) // 3][(i + 1) % 3].scatter(result.success[:, 0], result.success[:, 1], label=label, s=20, color=color, marker='.') if len(result.false) > 0: ax[(i + 1) // 3][(i + 1) % 3].scatter(result.false[:, 0], result.false[:, 1], label=label, s=20, color=color, marker='x') ax[(i + 1) // 3][(i + 1) % 3].set_title('Player ' + label, fontsize=20) #ax[(i+1)//3][(i+1)%3].legend() plt.tight_layout() plt.savefig(save_path) plt.close()