MCPcopy Create free account
hub / github.com/VisionLearningGroup/OVANet / plot_embedding

Function plot_embedding

utils/tsne_visualize_labeled.py:18–36  ·  view source on GitHub ↗
(X, label, title=None)

Source from the content-addressed store, hash-verified

16colormap = plt.cm.gist_ncar #nipy_spectral, Set1,Paired
17colorst = [colormap(i) for i in np.linspace(0, 0.9, N)]
18def plot_embedding(X, label, title=None):
19 plt.figure()
20 ax = plt.subplot(111)
21 #color_dict = {0:'b',1:'r'}
22 for i in range(N):
23 inds = np.where(label==i)[0]
24 plt.scatter(X[inds, 0], X[inds, 1],color=colorst[i],label=str(i))
25
26 ax.tick_params(labelbottom="off", bottom="off")
27 ax.tick_params(labelleft="off", left="off")
28 plt.tick_params(color='white')
29 ax.spines["right"].set_color("none")
30 ax.spines["left"].set_color("none")
31 ax.spines["top"].set_color("none")
32 ax.spines["bottom"].set_color("none")
33 #ax.legend(loc='upper left')
34 #plt.legend()
35 plt.savefig(title)
36 return X#(X - x_min) / (x_max - x_min)
37def plot_embedding2(X, label, title=None):
38 plt.figure()
39 ax = plt.subplot(111)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected