[R] Setting maximum value of the legend on an image.plot and animation

Uwe Ligges ligges at statistik.tu-dortmund.de
Sat Feb 5 18:22:20 CET 2011



On 01.02.2011 16:10, Steve_Friedman at nps.gov wrote:
>
> Hello,
>
> I'm doing the following:
>
> library(ncdf)
> library(fields)
> library(animation)
>
> saline<-  open.ncdf("salinity_1990.nc")
> salt = get.var.ncdf(nc=saline, varid="Salinity")
>
> # create an animation of the complete temporal domain in the ncdf file.
> saveHTML({
>
>          for (i in 1:364) {
>            image.plot(salt[, , i])
>        }
>      }, img.name = "salinity.img", imgdir = "salinity_dir", htmlfile =
> "salinity.html", zmax = c(0, 80),
>         autobrowse = FALSE, title = "TIME SALINITY PREDICTIONS",
>          description = c("This should plot 1 years daily salinity
> predictions in Florida Bay")
>        )
>
> Almost all of the data sets I work with are multi-temporal spatial forms.
> Being able to view the time sequence is very important to us, The animation
> procedure is very good. I appreciate its development.
>
> Here are my questions.
> 1) I would like to find a procedure to set the maximum value of the legend
> of an image.plot.  Each time step has a different maximum value, but for
> the animation to be valuable, I need to standardize these to a maximum such
> that the scale is equal in each time step.


Specify the breaks manually using the argument "breaks" that can be 
passed to "..." in image.plot().


> 2)  Secondly, when setting imgdir it only goes to a temp directory.  If I
> define a directory, the new directory path is added to the default temp
> directory path.  Is there a way to fix this so that the output directory is
> truly defined in the saveHTML statements?


I don't see a way, so just ask the maintainer of the animation package 
to allow for absolute paths or so.

Uwe Ligges


> I'm working on a windows XP machine using R 2.12.1.
>
>
> Thanks
> Steve
>
>
> Steve Friedman Ph. D.
> Ecologist  / Spatial Statistical Analyst
> Everglades and Dry Tortugas National Park
> 950 N Krome Ave (3rd Floor)
> Homestead, Florida 33034
>
> Steve_Friedman at nps.gov
> Office (305) 224 - 4282
> Fax     (305) 224 - 4147
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list