By starting from this question I came up with this solution;
import matplotlib.image as image
from matplotlib import pylab
# constants
imageSize = (32,32) ### I REMOVED DPI SETTINGS
fig = pylab.figure()
ax = fig.add_subplot(111)
# plot our line with transparent markers, and markersize the size of our image
line, = ax.plot(Xtsne_smp[:,0],Xtsne_smp[:,1],"bo",mfc="None",mec="None",markersize=imageSize[0])
# we need to make the frame transparent so the image can be seen
# only in trunk can you put the image on top of the plot, see this link:
# http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg14534.html
#ax.get_frame().set_alpha(0) ### Gives ERROR
ax.set_xlim((0,5))
ax.set_ylim((0,5))
# translate point positions to pixel positions
# figimage needs pixels not points
line._transform_path()
path, affine = line._transformed_path.get_transformed_points_and_affine()
path = affine.transform_path(path)
for count,pixelPoint in enumerate(path.vertices):
# place image at point, centering it
im = image.imread(image_paths_smp[count]) ### MY ADDITION
im = im.resize([32,32]) ### MY ADDITION
fig.figimage(im,pixelPoint[0]-imageSize[0]/2,pixelPoint[1]-imageSize[1]/2,origin="upper")
pylab.show()
This code gives me a empty plot without any figure.
In my setting, I have images for each data point and I would like to picture these images for each data marker. Starting from this code or any other solution, how can I do this in matplotlib?