I'm working on a demonstration for a dimensionality reduction method where the data (images) gets projected in a 2D space and labels are added like that:
# (x[i], y[i]) are the embedding coordinates of the i'th sample
plt.plot(x, y, 'ro')
labels = ['image {0}'.format(i+1) for i in range(len(x))]
for label, xpt, ypt in zip(labels, x, y):
plt.annotate(
label,
xy = (xpt, ypt), xytext = (-20, 20),
textcoords = 'offset points', ha = 'right', va = 'bottom')
# some styles not related to the question
plt.show()
This approach suffers from having to look up every single image in order to get an idea if the algorithm produced reasonable results.
Is there any way to replace the text labels with (thumbnails of) the images that are actually being used? (It's only for presentation purposes so there won't be huge junks of data cluttering up everything)