Interactive graph demonstration using a modified version of B. Rowlingson's imagemap package:

This demo creates a plot of life expectancy versus high-school graduation rate by state from the 1977 US census data (a dataset that comes with R). Position the mouse pointer over the datapoint to see what state the datapoint came from.

# First, we generate the plot and imagemap.
im = imagemap("Plot", width = 500, height = 400) 

# make a graph
plot(state.x77[,"Life Exp"], state.x77[,"HS Grad"], 
     xlab = "Life expectancy, years", 
     ylab = "High-school graduation rate, percent",

# make the image map boundaries
for (i in seq(along =
    addRegion(im) = imPoint( 
        state.x77[i,"Life Exp"], 
        state.x77[i,"HS Grad"], .1, 1, 
        onmouseover = 
            paste("javascript:document.getElementById('results').innerHTML ='",
                  HTMLh3([i]), "';", sep="")
dummy = capture.output(imClose(im)) # the capture.output is just to hide the output

#Now, we can make the HTML for display:

HTMLtag("span", contenteditable="false")

# Create a DIV to display the interactive updates.
# The result is absolutely positioned relative to the graphic.
# Use top & left to adjust the position.
HTMLtag("span", id="results")
HTMLh3(" ")

# display the image with the imagemap