'How to add .text that corresponds to array index in a scatter plot? Python
I have an array of decoded data that that corresponds to an original array of images. I want to know which point in the scatter plot corresponds to which image (or the decoded array index). I was thinking of using the plt.text function to show the index next to each point in the scatter, how can I go about this? Here is my code. And a photo of current output 
encoder = Model(m.input, m.get_layer('bottleneck').output)
encoded = encoder.predict(imgs_array)
decoded = m.predict(imgs_array)
encoder.summary()
pca=PCA(n_components=2)
imgs_array_pca=pca.fit_transform(imgs_array)
x_pca_inv=pca.inverse_transform(imgs_array_pca[:,:2])
loss=((imgs_array - x_pca_inv) ** 2).mean()
fig, ax= plt.subplots(1,2, figsize=(12,8))
ax[0].scatter(encoded[:9000,0], encoded[:9000,1])
ax[0].set_title("Autoencoder")
ax[0].axis('on')
ax[1].scatter(imgs_array_pca[:,:2][:9000,0], imgs_array_pca[:,:2][:9000,1])
ax[1].set_title("PCA")
ax[1].axis('on');
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
