views:

106

answers:

2

I have a large graph that I am generating in matplotlib. I'd like to add a number of icons to this graph at certain (x,y) coordinates. I am wondering if there is any way to do that in matplotlib

Thank you

+2  A: 

It's definitely possible. Here is a start:

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()

Icon overlap

In this example, the icon's position was not defined in terms of the plot's (x,y) coordinates; maybe someone else can help with that. Nevertheless, I hope this example is helpful.

Steve
+1  A: 
Jouni K. Seppänen