This is an issue that I always wanted to investigate but haven't gotten around to solving yet: The tooltips for contour lines in a plot like this can be very useful in the Notebook interface:

ContourPlot[3 x y^2 - x^3, {x, -1, 1}, {y, -1, 1}, 
ContourShading -> False, Contours -> Table[r^3, {r, -1.4, 1.4, .1}]]

However, when I export the Notebook containing the plot as an HTML file, I get the following image:

enter image description here

It appears to have tooltips, as the screen shot shows (the mouse arrow isn't captured, but the yellow tooltip is). However, those tooltips are generated by an image map that defines some very inaccurate target areas for the contour values to be displayed when the mouse hovers over them. The result is worse than having no tooltips at all, because the displayed values are plain wrong and hence confusing most of the time. To see the exported HTML in real life, look at this URL exported from Mathematica 7 (version 8 does the same thing, I've just had this problem for a long time...).

My first question would be: what is the best way to disable the use of image maps in the HTML generated by the Save As HTML operation? My current thought is that I'll have to post-process the generated HTML file to remove the usemap part of all image tags. But maybe someone knows a better way.

I would also like to keep the tooltips for the graphics in the Notebook.

The second question is how one could export a plot like the above so that it can be used in a HTML file while preserving correct tooltips. Here, my thought would be to export to SVG and add the tooltips to the generated lines in a post-processing step (the SVG file seems to contain enough information to allow this). However, I'm again hoping that someone has a better idea.


1 Answer 1


Some time ago I wanted to have good tooltips for images composed by polygons. Mathematica generated square areas only, and the polygons had many shapes. Then I did my own export function for polygons with tooltips. I basicaly rescaled all the polygon points to the image size and wrote the image maps. I never found how to get the right area from Mathematica. I also investigated the SVG, but didn't find anything useful (didn't get the tooltips to work). I will have to check the SVG capabilities of M8, but I guess they have not change much.

  • $\begingroup$ I'm looking to re implement this feature so Mathematica supports exporting images with the correct data maps. Do you mind double checking to see if you still have the code before I go though the entire process? $\endgroup$
    – William
    Jul 1, 2013 at 0:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.