Data visualization with SAS programming

Animated Heat Map

Reply
Frequent Contributor
Posts: 148

Animated Heat Map

I have count data for an X-Y coordinate system over time. I would like to display it using a heat map that is an animated gif file where the animation scrolls thru the time axes.

I found this example (as well as a bunch of others):

http://support.sas.com/documentation/cdl/en/grstatgraph/65377/HTML/default/viewer.htm#p0gf6kx2u9fewe...

But I have been unable to get it to produce an animated GIF.

Is this even possible?

And if so, any suggestions on how to make it work?

If not, any other suggested approaches to do this?

TIA,

Don H

SAS Employee
Posts: 967

Re: Animated Heat Map

I guess this is a 2-part question.

For the first part, exactly what would you like your "heat map" to look like? Could you show an example?

For the 2nd part (animation), here are several examples:

Robert Allison's SAS/Graph Samples!</title><link rel=File-List href="index_files/filelist.xml"><link...

Also note that in 9.4, the syntax for creating gif animations was made simpler ... so if you've got 9.4, then you can take advantage of that Smiley Happy

Robert Allison's What's New in V9.4 SAS/GRAPH...

SAS Super FREQ
Posts: 1,080

Re: Animated Heat Map

See my blog article on gif animatiion using SGPLOT.  You can use GTL and SGRENDER for the graphics part for heatmap.  The animation code will be similar.

Note, to keep the color mappings constant through the animation, I suggest using the RangeAttrMap to control the mapping of color to response values..

http://blogs.sas.com/content/graphicallyspeaking/2013/05/23/animation-using-sgplot/

Frequent Contributor
Posts: 148

Re: Animated Heat Map

Thanks Robert and Sanjay. These look like they will do exactly what I want.

And Rob, I do have 9.4 and so I can take advantage of the simpler syntax. In looking at both of your responses I recognize that my attempts did not work as I was using Jurassic SAS/Graph options to try and do this.

I have a fair amount of data management work to do before I have the data for this. Now that I know I can do an animated heat map the structure of the output data set will likely be tweaked a bit.

I will post an example of the output once I have gotten things working.

Thanks to both of you for your incredibly helpful and quick responses.

Don H

Frequent Contributor
Posts: 148

Re: Animated Heat Map

Sanjay/Rob,

Hope you don't mind another question. Using the template code from the line in my original question, and with the changes you both suggested, I now am able to produce an animated gif (attached). It got it to work both with a by variable as well as via macro looping.

This is geospatial (latitude X longitude buckets) over time. Latitude and Longitude are the x,y coordinates and time is the by variable. I would like to have the same colorresponse shown regardless of the by group. But I can't see how to do that.

Is it possible to do that? And if so, can you point me in the right direction?

TIA,

Don H.

PS, in the editor, the animation of the gif file is used. But once the message was posted it was gone. If you want to see the animation you have to right click and open in new window.

GeoSpatial.gif

SAS Super FREQ
Posts: 1,080

Re: Animated Heat Map

Did you create the graph using GPLOT or GTL?  If GTL, you can use the RangeAttributeMap such that it will be consistent for all the values across all the time steps.  This is what I alluded to in my earlier reply.

Frequent Contributor
Posts: 148

Re: Animated Heat Map

I used GTL and I think I must have confused RangeAttributeMap with another option as what I looked at appeared to be for discrete values instead of continuous ones. I found the doc for RangeAttributeMap and it looks like it will do what I need.

Thx again!!!!!

SAS Super FREQ
Posts: 1,080

Re: Animated Heat Map

Yes, GTL also has a DiscreteAttributesMap.  Smiley Wink

Ask a Question
Discussion stats
  • 7 replies
  • 925 views
  • 0 likes
  • 3 in conversation