def plot_pca_components(filename, components): colormap = brewer2mpl.get_map('Set1', 'qualitative', 9) p = Ppl(colormap, alpha=1) fig, ax = plt.subplots(1) p.pcolormesh(fig, ax, components.values) ax.set_xticks([]) yticks = np.linspace(len(components) - 0.5, 0.5, len(components)) ax.set_yticks(yticks) y_ticklabels = map(lambda x: 'PCA %s'%x, range(len(components))) ax.set_yticklabels(y_ticklabels) fig.savefig(filename) return fig, ax
def plot_correlation_matrix(filename, correlation_matrix, labels): size = correlation_matrix.shape[0] colormap = brewer2mpl.get_map('Set1', 'qualitative', 9) p = Ppl(colormap, alpha=1) fig, ax = plt.subplots(1) #masked_jaccard = np.ma.masked_where(np.isnan(jaccard_matrix), jaccard_matrix) p.pcolormesh(fig, ax, correlation_matrix) #ax.imshow(jaccard_matrix, interpolation = 'none') ax.set_xticks([]) yticks = np.linspace(size - 0.5, 0.5, size) ax.set_yticks(yticks) labels.reverse() ax.set_yticklabels(labels) ax.set_xticks(yticks) ax.set_xticklabels(labels) fig.savefig(filename) return fig, ax
def plot_group_overlap(filename, jaccard_matrix): size = jaccard_matrix.shape[0] colormap = brewer2mpl.get_map('Set1', 'qualitative', 9) p = Ppl(colormap, alpha=1) fig, ax = plt.subplots(1) masked_jaccard = np.ma.masked_where(np.isnan(jaccard_matrix), jaccard_matrix) p.pcolormesh(fig, ax, masked_jaccard) #ax.imshow(jaccard_matrix, interpolation = 'none') ax.set_xticks([]) yticks = np.linspace(size - 0.5, 0.5, size) ax.set_yticks(yticks) y_ticklabels = map(lambda x: 'F%s'%x, range(1,size+1)) y_ticklabels.reverse() ax.set_yticklabels(y_ticklabels) ax.set_xticks(yticks) ax.set_xticklabels(y_ticklabels) fig.savefig(filename) return fig, ax
def plot_image_matrix(filename, jaccard_matrix, x_ticklabels = None, y_ticklabels = None): colormap = brewer2mpl.get_map('Set1', 'qualitative', 9) p = Ppl(colormap, alpha=1) fig, ax = plt.subplots(1) masked_jaccard = np.ma.masked_where(np.isnan(jaccard_matrix), jaccard_matrix) p.pcolormesh(fig, ax, masked_jaccard) print x_ticklabels print y_ticklabels #ax.imshow(jaccard_matrix, interpolation = 'none') #ax.set_xticks([]) yticks = range(jaccard_matrix.shape[0]+1) xticks = range(jaccard_matrix.shape[1]+1) ax.set_yticks(yticks) ax.set_xticks(xticks) #x_ticklabels.reverse() ax.set_yticklabels(y_ticklabels) ax.set_xticklabels(x_ticklabels) ax.set_ylabel(fl('ratioagent')) ax.set_xlabel(fl('ratiolatency')) fig.savefig(filename) return fig, ax