0

I'm plotting a scatter plot of attributes of faces of people, and instead of a point marker, would like to use a little icon of the person's face as a point on the plot. From a related thread from many years ago, it's been shown how to do this in part:

Adding a small photo/image to a large graph in Matplotlib/Python

However, this thread does not make mention of how to specify the icon coordinates in terms of x and y values of the plot. Given that I have the X, Y values corresponding to the datapoints at which I want to center the icons of faces, how can I adapt this example? Here is the accepted answer from that thread:

import matplotlib, scipy
fig = matplotlib.figure()
ax = fig.add_axes([0.1,0.1,0.8,0.8])
axicon = fig.add_axes([0.4,0.4,0.1,0.1])
ax.plot(range(5), [4,2,3,5,1])
axicon.imshow(scipy.randn(100,100))
axicon.set_xticks([])
axicon.set_yticks([])
fig.show()

The line that throws me off is:

axicon = fig.add_axes([0.4,0.4,0.1,0.1])

How do I translate this to x,y values on the plot?

enter image description here

Community
  • 1
  • 1
Adam Hughes
  • 14,601
  • 12
  • 83
  • 122
  • However [this](http://stackoverflow.com/questions/2318288/how-to-use-custom-marker-with-plot) thread does. Trick lies in the mpl transformations module. – ljetibo Feb 25 '15 at 21:29
  • Np. I ran into that thread not even 2 days ago. Make sure you give the guy a thumbs up. – ljetibo Feb 25 '15 at 21:42

0 Answers0