diff --git a/local/plot_pca_similarities.py b/local/plot_pca_similarities.py index d087f29c9c427127806e97d292a830a0746435f1..55e6153301fcf8d3c9bd456096901d219dc8c9d6 100644 --- a/local/plot_pca_similarities.py +++ b/local/plot_pca_similarities.py @@ -13,13 +13,14 @@ import faiss from mpl_toolkits.mplot3d import Axes3D import matplotlib.patches as patches -# List of predefined colors for each corpus (you can add more if you like) +# List of predefined colors for each corpus (you can add more if necessary) colors = ['tab:red', 'tab:blue', 'tab:green', 'tab:orange', 'tab:purple', 'tab:brown', 'tab:pink', 'tab:gray', 'tab:olive', 'tab:cyan'] -# markersize + +# fontsize and markersize MS = 30 def main(X_path, y_path, pcaA_path, pcab_path, out_path, json_path): @@ -40,10 +41,17 @@ def main(X_path, y_path, pcaA_path, pcab_path, out_path, json_path): labels = list(spks) fig, ax = plt.subplots(figsize=(15,15)) cax = ax.matshow(X, interpolation='nearest') + # x-ticks fontsize + for label in ax.get_xticklabels(): + label.set_fontsize(25) + # y-ticks fontsize + for label in ax.get_yticklabels(): + label.set_fontsize(25) ax.grid() plt.xticks(range(len(labels)), labels, rotation=90); plt.yticks(range(len(labels)), labels); - fig.colorbar(cax, ticks=[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, .8, .9, 1]) + cbar = fig.colorbar(cax, ticks=[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, .8, .9, 1]) + cbar.ax.tick_params(labelsize=25) fig_path = os.path.join(out_path,'{}.png'.format(X_path.split('/')[-1].replace('.npy',''))) print('\nsave similarity matrix to {}'.format(fig_path)) plt.savefig(fig_path)