tags:

views:

986

answers:

3

I have a client that want to have a web app I'm building for them display heat maps of the data.

I haven't worked with heat maps at all and I was wondering if anyone knew of some good tools for generating them.

Thanks.

+3  A: 

I'll assume this is data with three values per data-point - we'll call them x, y and z. It would really help if x and y were spatial coordinates as that makes things easier.

Anyway, generate a bitmap of x by y (scaled appropriately).

For each x and y pair in the data, scale z to between 0 and 1 (or 0 and however many colours you have in your map), and plot z as a colour represented by that value. E.g. a simple map could just use the R portion of RGB, in which case you'd have 256 graduations for your red.

Most likely, you'd want something more fancy, but you should be able to get the idea.

If your datapoints are spread apart, you can either plot them as rectangles that take up the space, or smoothly interpolate between them.

NOTE: THere is a web-based tool that does it here. I found it linked from the Wikipedia article on heatmaps. There's a java one too linked from there too.

Andrew Rollings
+3  A: 

Heat maps are often used in place of a more conventional term: kernel density estimators. If you need to compute these on the fly, consider GRASS GIS- specifically, the v.kernel or v.neighbors modules. These will generate a continuous estimate (i.e. raster surface) of density, at some target resolution (defined by the current region settings). GRASS GIS can be controlled via Python code, so it would be a simple matter to write a Python wrapper around the underlying modules, that could export the results to your web application.

For small datasets, the R project has several functions for reading/writing spatial data, and computing kernel density estimates.

Dylan
+5  A: 

I realize this is an old, old post -- but the next guy to stumble across this page might try gheat for heatmaps in webapps. There are ports for Django and Google App Engine, if you happen to be using those backends.

J.J.
Now that's handy, I was just going to ask this question... Thanks!
chiggsy
Could you provide the link for the App Engine port? All i seem to be able to find is a page saying "TODO" :/
Hamy
Wow - just found it. That always happens - it's at http://code.google.com/p/gheat-ae/source/browse/#svn/trunk/gHeatAE/src
Hamy