On Tue, Jun 14, 2011 at 19:56, idris <idris.r...@gmail.com> wrote: > Follow up question: My data contains x, y, height, and day. > > I want to create the heatmap for each day, keeping the color coding > consistent. > > I've created an example with 2 days, and you can see the charts below. > > Notice that the legend changes from day 1 to day 2. How can I make the > legend consistent? > > Also, my real data contains hundreds of days. Is there a way to create a > 'movie' or a sequence of the heatmaps in chronological order of days? > > The way my code works now is obviously very naive as it just repeats the > same code for day 1 and day 2. Is there a better way to do this?
legend: use the "limit" argument of scale_fill_gradientn and set it to the max and min of height across all days movie: there is no way to do that in R alone (that I know of). you can: 1- use the jpeg or png device with a name including a special code which increases every time a new plot is produced (this is the default) 2- plot the successive plots in a for loop 3- turn the sequence of images into a movie using specialized software. For step 3 you could use guicktime on Mac OS X or mencoder on Linux/OS X. I don't know about Windows. Since mencoder works on the command line, you can call it from R and I have code to ease that: https://gitorious.org/r/r-utils/blobs/master/lib_movie.R but you should get familiar with mencoder a little bit before trying to read/understand it. JiHO --- http://maururu.net ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.