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

Steve_Friedman at nps.gov Steve_Friedman at nps.gov
Tue Feb 1 16:10:10 CET 2011


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.

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'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



More information about the R-help mailing list