# URLs embedded in PNG or JPEG

You could use html image maps to accomplish this.

> Obviously this would be in the context of a web page. I
> think frontpage or dreamweaver has some nice tools for
> creating these. Just google "html image maps" for more
> info.

Andrew Dalke has a tutorial on creating html image maps with
matplotlib

http://www.dalkescientific.com/writings/diary/archive/2005/04/24/interactive_html.html

JDH

> You could use html image maps to accomplish this.
> Obviously this would be in the context of a web page. I
> think frontpage or dreamweaver has some nice tools for
> creating these. Just google "html image maps" for more
> info.

Andrew Dalke has a tutorial on creating html image maps with
matplotlib

http://www.dalkescientific.com/writings/diary/archive/2005/04/24/interactive_html.html

JDH

This tutorial was a start. I want to do a similar thing, but use
rectangle objects for the image map, whose coordinates are derived
from matplotlib polygon objects. I was wondering if anyone knew how
to do this, or could point me to some documentation.

Basically I have a simple figure:

from pylab import *

clf()
fig = figure(1,(4,4))
ax = axis()
pl = plot(range(0,10),range(0,10),'b-')
box = axvspan(3,5,fc='m',alpha=0.5)

#get vertices [(ul.x,ul.y),(lr.x,lr.y)]
#ul = upper left
#lr = lower right
#have to multiply ul.y by the upper ylim since for axvspan, ul.y=1
spans the range
b_verts = box.get_verts()
verts = [(b_verts[1][0],b_verts[1][1]*ax.get_ylim()[1]),(b_verts[3][0],b_verts[3][1])]

my question is what transform do I use to convert verts to pixel coordinates?
ax.get_transform() does not work. Should I use pl.get_transform?