11/26/2023 0 Comments Matplotlib 3d scatter axis labels![]() ![]() In Your code you need split base your Label and use this code. ![]() Plt.legend((c1, c2, c3, c4, c5),('Class 1',īecause I don't have your tsne_x, tsne_y, tsne_z. Is there a way to determinate the color for each Class? So the both plots have the exact same color for each classīased on answer I change my code to this: import re, seaborn as sns, numpy as np, pandas as pd, randomĬolors = Ĭ1 = ax.scatter(x, y, z, color=colors)Ĭ2 = ax.scatter(x, y, z, color=colors)Ĭ3 = ax.scatter(x, y, z, color=colors)Ĭ4 = ax.scatter(x, y, z, color=colors)Ĭ5 = ax.scatter(x, y, z, color=colors) How can I change the name of the Classes in the legend, instead of numbers show the name of the classes? Legend = ax.legend(*g.legend_elements(), loc="lower center", title="Classes", borderaxespad=-10, ncol=5) ![]() G = ax.scatter(x, y, z, c=Y, marker='o', cmap = sns.color_palette('hls', n_colors=5 ,as_cmap=True)) Input: import re, seaborn as sns, numpy as np, pandas as pd, randomįrom matplotlib.pyplot import plot, show, draw, figure, cm Palette = sns.color_palette('hls', n_colors=5), Input: f, ax = plt.subplots(figsize=(12, 12)) My Y above have 5 classes, and I'm plotting 2D: So, I did this to have a 3 dimensional matrix: X_comp = TSNE( n_components = 3 ).fit_transform(X) I'm processing text (dataset with 1000 documents - applying Doc2Vec using Gensim lib), at the end I have a 300 dimension matrix for each doc. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |