[Raster-commits] r402 - in pkg/raster: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Apr 12 18:04:02 CEST 2009


Author: rhijmans
Date: 2009-04-12 18:03:59 +0200 (Sun, 12 Apr 2009)
New Revision: 402

Added:
   pkg/raster/R/plotBbox.R
   pkg/raster/R/readRow.R
   pkg/raster/R/readRows.R
   pkg/raster/R/writeFormats.R
   pkg/raster/R/writeRasterBlock.R
   pkg/raster/man/hist.Rd
   pkg/raster/man/plot.Rd
   pkg/raster/man/plotBbox.Rd
Removed:
   pkg/raster/R/lines.R
   pkg/raster/man/map.Rd
   pkg/raster/man/plot-methods.Rd
Modified:
   pkg/raster/DESCRIPTION
   pkg/raster/NAMESPACE
   pkg/raster/R/hist.R
   pkg/raster/R/map.R
   pkg/raster/R/plot.R
   pkg/raster/R/readRaster.R
   pkg/raster/R/write.R
   pkg/raster/R/writeRasterRow.R
   pkg/raster/man/click.Rd
   pkg/raster/man/draw.Rd
   pkg/raster/man/setDatatype.Rd
Log:


Modified: pkg/raster/DESCRIPTION
===================================================================
--- pkg/raster/DESCRIPTION	2009-04-12 03:26:13 UTC (rev 401)
+++ pkg/raster/DESCRIPTION	2009-04-12 16:03:59 UTC (rev 402)
@@ -1,8 +1,8 @@
 Package: raster
 Type: Package
 Title: Raster data handling for geographic data analysis and modeling
-Version: 0.8.9-11
-Date: 6-April-2009
+Version: 0.8.9-12
+Date: 12-April-2009
 Depends: methods, sp, rgdal (>= 0.5-33), R (>= 2.8.0)
 Author: Robert J. Hijmans & Jacob van Etten
 Maintainer: Robert J. Hijmans <r.hijmans at gmail.com> 

Modified: pkg/raster/NAMESPACE
===================================================================
--- pkg/raster/NAMESPACE	2009-04-12 03:26:13 UTC (rev 401)
+++ pkg/raster/NAMESPACE	2009-04-12 16:03:59 UTC (rev 402)
@@ -4,5 +4,5 @@
 importFrom("utils", stack, unstack)
 importFrom("sp", overlay, bbox, Spatial, SpatialPixels, SpatialPixelsDataFrame, SpatialGrid, SpatialGridDataFrame)
 exportClasses(BoundingBox, BasicRaster, Raster, RasterLayer, RasterStack)
-exportMethods(raster, calc, overlay, bbox, aggregate, stack, unstack, show, summary, plot, hist, ncol, nrow, ncell, dim, lines, Median)
+exportMethods(raster, calc, overlay, bbox, aggregate, stack, unstack, show, summary, plot, hist, ncol, nrow, ncell, dim, Median)
 exportPattern("^[^\\.]")
\ No newline at end of file

Modified: pkg/raster/R/hist.R
===================================================================
--- pkg/raster/R/hist.R	2009-04-12 03:26:13 UTC (rev 401)
+++ pkg/raster/R/hist.R	2009-04-12 16:03:59 UTC (rev 402)
@@ -5,14 +5,14 @@
 # Licence GPL v3
 
 setMethod('hist', signature(x='RasterStack'), 
-	function(x, layer=1, maxsamp=10000, ...) {
+	function(x, layer=1, maxsamp=100000, ...) {
 		x <- asRasterLayer(x, layer)
-		hist(x, maxsamp=10000, ...)
+		hist(x, maxsamp=100000, ...)
 	}
 )
 
 setMethod('hist', signature(x='Raster'), 
-	function(x, maxsamp=10000, ...){
+	function(x, maxsamp=100000, ...){
 		if (dataContent(x) != 'all') {
 			if (dataSource(x) == 'disk') {
 		# TO DO: make a function that does this by block and combines  all data into a single histogram

Deleted: pkg/raster/R/lines.R
===================================================================
--- pkg/raster/R/lines.R	2009-04-12 03:26:13 UTC (rev 401)
+++ pkg/raster/R/lines.R	2009-04-12 16:03:59 UTC (rev 402)
@@ -1,27 +0,0 @@
-# Author: Robert J. Hijmans, r.hijmans at gmail.com
-# International Rice Research Institute
-# Date: March 2009
-# Version 0.8
-# Licence GPL v3
-
-
-if (!isGeneric("lines")) {
-	setGeneric("lines", function(x, ...)
-		standardGeneric("lines"))
-}
-
-#setMethod("lines", signature(x='ANY'), 
-#	function(x, ...) {
-#		graphics::lines(x, ...)
-#	}
-#)
-
-
-setMethod("lines", signature(x='BoundingBox'), 
-	function(x, ...)  {
-		xy <- .bboxmatrix(x)
-		xy[5,] <- xy[1,]
-		lines(xy, ...)
-	}
-)	
-

Modified: pkg/raster/R/map.R
===================================================================
--- pkg/raster/R/map.R	2009-04-12 03:26:13 UTC (rev 401)
+++ pkg/raster/R/map.R	2009-04-12 16:03:59 UTC (rev 402)
@@ -6,7 +6,7 @@
 
 
 
-map <- function(object, index=1, col = rev(terrain.colors(25)), subsample=TRUE, maxdim=500, addbox=TRUE, axes = TRUE, xlab="", ylab="", ...) {
+.plotraster <- function(object, index=1, col = rev(terrain.colors(25)), subsample=TRUE, maxdim=500, addbox=TRUE, axes = TRUE, xlab="", ylab="", ...) {
 #TODO if xlim and/or ylim are used, only read (and sample) for those areas.
 #	require(fields)
 	if (class(object) == 'character') { 

Modified: pkg/raster/R/plot.R
===================================================================
--- pkg/raster/R/plot.R	2009-04-12 03:26:13 UTC (rev 401)
+++ pkg/raster/R/plot.R	2009-04-12 16:03:59 UTC (rev 402)
@@ -5,47 +5,22 @@
 # Licence GPL v3
 
 
-.bboxmatrix <- function(x) {
-	xy <- matrix(NA, nrow=5, ncol=2)
-	xy[1,1] <- x at xmin
-	xy[1,2] <- x at ymax
-	xy[2,1] <- x at xmax
-	xy[2,2] <- x at ymax
-	xy[3,1] <- x at xmax
-	xy[3,2] <- x at ymin
-	xy[4,1] <- x at xmin
-	xy[4,2] <- x at ymin
-	return(xy)
-}
 
-
-setMethod("plot", signature(x='BoundingBox', y='ANY'), 
-	function(x, y, ...)  {
-		xy <- .bboxmatrix(x)
-		xy[5,] <- xy[1,]
-		plot(xy, type='l', ...)
-		if (class(y) == 'BoundingBox') {
-			lines(y)
-		}
-	}
-)	
-
-
 setMethod("plot", signature(x='Raster', y='missing'), 
 	function(x, y, ...)  {
-		map(x, ...)
+		.plotraster(x, index=1, col=rev(terrain.colors(25)), subsample=TRUE, maxdim=500, addbox=TRUE, axes = TRUE, xlab="", ylab="", ...) 
 	}
 )	
 
 setMethod("plot", signature(x='Raster', y='numeric'), 
-	function(x, y, ...)  {
-		map(x, y, ...)
+	function(x, y=1, ...)  {
+		.plotraster(x, index=y, col=rev(terrain.colors(25)), subsample=TRUE, maxdim=500, addbox=TRUE, axes = TRUE, xlab="", ylab="", ...) 
 	}
 )		
 
 
 setMethod("plot", signature(x='RasterLayer', y='RasterLayer'), 
-	function(x, y, maxdim=1000, cex=0.1, ...)  {
+	function(x, y, maxdim=10000, cex=0.1, ...)  {
 		comp <- compare(c(x, y), bb=TRUE, rowcol=TRUE, prj=FALSE, tolerance=0.0001, stopiffalse=TRUE) 
 		nc <- ncell(x)
 		x <- sampleSkip(x, maxdim=maxdim)

Added: pkg/raster/R/plotBbox.R
===================================================================
--- pkg/raster/R/plotBbox.R	                        (rev 0)
+++ pkg/raster/R/plotBbox.R	2009-04-12 16:03:59 UTC (rev 402)
@@ -0,0 +1,38 @@
+# Author: Robert J. Hijmans, r.hijmans at gmail.com
+# International Rice Research Institute
+# Date :  January 2009
+# Version 0.8
+# Licence GPL v3
+
+
+.bboxmatrix <- function(x) {
+	xy <- matrix(NA, nrow=5, ncol=2)
+	xy[1,1] <- x at xmin
+	xy[1,2] <- x at ymax
+	xy[2,1] <- x at xmax
+	xy[2,2] <- x at ymax
+	xy[3,1] <- x at xmax
+	xy[3,2] <- x at ymin
+	xy[4,1] <- x at xmin
+	xy[4,2] <- x at ymin
+	return(xy)
+}
+
+
+setMethod("plot", signature(x='BoundingBox', y='ANY'), 
+	function(x, y, add=TRUE, ...)  {
+		xy <- .bboxmatrix(x)
+		xy[5,] <- xy[1,]
+		if (add) {
+			lines(xy, ...) 
+		} else {
+			plot(xy, type='l', ...)
+		}
+		if (!missing(y)) {
+			if (class(y) == 'BoundingBox') {
+				plot(x=y, add=TRUE, ...)
+			}
+		}
+	}
+)	
+

Modified: pkg/raster/R/readRaster.R
===================================================================
--- pkg/raster/R/readRaster.R	2009-04-12 03:26:13 UTC (rev 401)
+++ pkg/raster/R/readRaster.R	2009-04-12 16:03:59 UTC (rev 402)
@@ -6,7 +6,7 @@
 # Licence GPL v3
 
 
-.rasterRead <- function(raster, rownr,  startcol=1, ncolumns=(ncol(raster)-startcol+1)) {
+.rasterRead <- function(raster, rownr, startcol=1, ncolumns=(ncol(raster)-startcol+1)) {
 	rownr <- round(rownr)
 	ncolums <- round(ncolumns)
 	if (rownr == 0) { stop("rownr == 0. It should be between 1 and nrow(raster), or < 0 for all rows") }
@@ -16,12 +16,14 @@
 	if (ncolumns < 1) { stop("ncols should be > 1") }
 
 	endcol <- startcol + ncolumns - 1
-	if (endcol > ncol(raster)) {
-		warning("ncolumns too high, truncated")
-		endcol <- ncol(raster) 
-		ncolumns <- ncol(raster) - startcol + 1  
-	}
 	
+# allowing this for readRows
+#	if (endcol > ncol(raster)) {
+#		warning("ncolumns too high, truncated")
+#		endcol <- ncol(raster) 
+#		ncolumns <- ncol(raster) - startcol + 1  
+#	}
+	
 	if (dataSource(raster)=='ram') {
 		if (rownr < 1) {
 			if (dataContent(raster) != 'all') {
@@ -38,7 +40,6 @@
 		if (!file.exists( filename(raster))) { 
 			stop(paste(filename(raster)," does not exist"))
 		}
-		#con <- file(rastergri, "rb")
 		
 		dtype <- .shortDataType(raster at file@datanotation)
 		if (dtype == "INT" | dtype == "LOG" ) { 
@@ -95,13 +96,14 @@
 		raster at data@indices <- c(1, ncell(raster))
 		raster at data@content <- "all"
 		raster <- setMinMax(raster)
-	} else if (startcol==1 & ncolumns==(ncol(raster)-startcol+1)) {
-		raster at data@indices <- c(cellFromRowCol(raster, rownr, startcol), cellFromRowCol(raster, rownr, endcol))
-		raster at data@content <- "row"
 	} else {
-		raster at data@indices <- c(cellFromRowCol(raster, rownr, startcol), cellFromRowCol(raster, rownr, endcol))
-		raster at data@content <- "block"
-	}	
+		raster at data@content <- 'row' 
+		firstcell <- cellFromRowCol(raster, rownr, 1)
+		lastcell <- cellFromRowCol(raster, rownr, raster at ncols)
+		raster at data@indices <- c(firstcell, lastcell)
+	}
 	
 	return(raster)
 }
+
+

Added: pkg/raster/R/readRow.R
===================================================================
--- pkg/raster/R/readRow.R	                        (rev 0)
+++ pkg/raster/R/readRow.R	2009-04-12 16:03:59 UTC (rev 402)
@@ -0,0 +1,19 @@
+# Author: Robert J. Hijmans, r.hijmans at gmail.com
+# Date : June 2008
+# Version 0.8
+# Licence GPL v3
+
+
+#read a single row of data
+
+.rasterReadRow <- function(raster, r) {
+	if (row < 1 ) { stop("startrow too small") } 
+	if (row > raster at nrows ) { stop("row should be <= nrow(raster)") } 
+	raster <- .rasterRead(raster, r)
+	raster at data@content <- 'row' 
+	firstcell <- cellFromRowCol(raster, row, 1)
+	lastcell <- cellFromRowCol(raster, row, raster at ncols)
+	raster at data@indices <- c(firstcell, lastcell)
+	return(raster)
+}
+

Added: pkg/raster/R/readRows.R
===================================================================
--- pkg/raster/R/readRows.R	                        (rev 0)
+++ pkg/raster/R/readRows.R	2009-04-12 16:03:59 UTC (rev 402)
@@ -0,0 +1,33 @@
+# Author: Robert J. Hijmans, r.hijmans at gmail.com
+# Date : June 2008
+# Version 0.8
+# Licence GPL v3
+
+
+#read a block of data  (a rectangular area  of any dimension)  
+
+.rasterReadRows <- function(raster, startrow, nrows=3) {
+	if (startrow < 1 ) { stop("startrow too small") } 
+	if (nrows < 1) { stop("nrows should be >= 1") } 
+	
+	endrow <- startrow+nrows-1
+	if (endrow > nrow(raster)) {
+		if (options('verbose')[[1]]) { 
+			warning("Rows beyond end of raster not read") 
+		}
+		endrow <- nrow(raster)
+		nrows <- endrow - startrow + 1
+	}
+	
+	nc <- raster at ncols * nrows
+	
+	raster <- .rasterRead(raster, startrow, 1, nc) 
+	
+	raster at data@content <- 'rows' 
+	firstcell <- cellFromRowCol(raster, startrow, 1)
+	lastcell <- cellFromRowCol(raster, endrow, ncol(raster))
+	raster at data@indices <- c(firstcell, lastcell)
+
+	return(raster)
+}
+

Modified: pkg/raster/R/write.R
===================================================================
--- pkg/raster/R/write.R	2009-04-12 03:26:13 UTC (rev 401)
+++ pkg/raster/R/write.R	2009-04-12 16:03:59 UTC (rev 402)
@@ -4,28 +4,17 @@
 # Version 0.8
 # Licence GPL v3
 
-
-writeFormats <- function() {
-	gd <- gdalDrivers()
-	gd <- as.matrix(subset(gd, gd[,3] == T))
-	short <- c("raster", "ascii", as.vector(gd[,1]))
-	long <- c("raster package format", "Arc ascii", as.vector(gd[,2]))
-	m <- cbind(short, long)
-	colnames(m) <- c("name", "long_name")
-	return(m)
-}
-
  
  
 writeRaster <- function(raster, filetype='raster', overwrite=FALSE, assign=FALSE) {
 	if (assign){ raster_name <- deparse(substitute(raster))}
 
-	if (dataContent(raster) != 'row' & dataContent(raster) != 'all' & dataContent(raster) != 'sparse' ) {
-		stop('No usable data available for writing. First use setValues()')
+	if (! dataContent(raster) %in% c('row', 'rows', 'all', 'sparse') ) {
+		stop('No usable data available for writing.')
 	}
 	
 	if (filetype=='raster') {
-		if (dataContent(raster) == 'row' ) {
+		if (substr(dataContent(raster), 1, 3) == 'row' ) {
 			raster <- .writeRasterRow(raster, overwrite=overwrite)
 		} else {
 			raster <- .writeRasterAll(raster, overwrite=overwrite)

Added: pkg/raster/R/writeFormats.R
===================================================================
--- pkg/raster/R/writeFormats.R	                        (rev 0)
+++ pkg/raster/R/writeFormats.R	2009-04-12 16:03:59 UTC (rev 402)
@@ -0,0 +1,18 @@
+# Author: Robert J. Hijmans, r.hijmans at gmail.com
+# International Rice Research Institute
+# Date :  November 2008
+# Version 0.8
+# Licence GPL v3
+
+
+writeFormats <- function() {
+	gd <- gdalDrivers()
+	gd <- as.matrix(subset(gd, gd[,3] == T))
+	short <- c("raster", "ascii", as.vector(gd[,1]))
+	long <- c("raster package format", "Arc ascii", as.vector(gd[,2]))
+	m <- cbind(short, long)
+	colnames(m) <- c("name", "long_name")
+	return(m)
+}
+
+ 
\ No newline at end of file

Added: pkg/raster/R/writeRasterBlock.R
===================================================================
--- pkg/raster/R/writeRasterBlock.R	                        (rev 0)
+++ pkg/raster/R/writeRasterBlock.R	2009-04-12 16:03:59 UTC (rev 402)
@@ -0,0 +1,36 @@
+ 
+.writeRasterRows <- function(raster, overwrite=FALSE) {
+#	if (dataContent(raster) != 'row') { 
+#		stop('raster does not contain a row') 
+#	}
+
+	if (dataIndices(raster)[1] == 1) { 
+		raster <- .startRowWriting(raster, overwrite=overwrite)
+ 	} 
+
+	raster at data@values[is.nan(raster at data@values)] <- NA
+	raster at data@values[is.infinite(raster at data@values)] <- NA
+	if (raster at file@dtype == "INT" || raster at file@dtype =='LOG' ) { 
+		values <- as.integer(round(raster at data@values))  
+		values[is.na(values)] <- as.integer(raster at file@nodatavalue)		
+	} else { 
+		values  <- as.numeric( raster at data@values ) 
+	}
+	
+	rsd <- na.omit(raster at data@values) # min and max values
+	if (length(rsd) > 0) {
+		raster at data@min <- min(raster at data@min, min(rsd))
+		raster at data@max <- max(raster at data@max, max(rsd))
+	}	
+	
+	writeBin(values, raster at file@con, size = raster at file@dsize )
+	
+	if (dataIndices(raster)[2] >= ncell(raster)) {
+		raster <- .stopRowWriting(raster)
+		if (dataIndices(raster)[2] > ncell(raster)) {
+			warning(paste('You have written beyond the end of file. last cell:', dataIndices(raster)[2], '>', ncell(raster)))
+		}
+	}
+	return(raster)	
+}
+

Modified: pkg/raster/R/writeRasterRow.R
===================================================================
--- pkg/raster/R/writeRasterRow.R	2009-04-12 03:26:13 UTC (rev 401)
+++ pkg/raster/R/writeRasterRow.R	2009-04-12 16:03:59 UTC (rev 402)
@@ -44,9 +44,6 @@
  
  
 .writeRasterRow <- function(raster, overwrite=FALSE) {
-#	if (dataContent(raster) != 'row') { 
-#		stop('raster does not contain a row') 
-#	}
 
 	if (dataIndices(raster)[1] == 1) { 
 		raster <- .startRowWriting(raster, overwrite=overwrite)

Modified: pkg/raster/man/click.Rd
===================================================================
--- pkg/raster/man/click.Rd	2009-04-12 03:26:13 UTC (rev 401)
+++ pkg/raster/man/click.Rd	2009-04-12 16:03:59 UTC (rev 402)
@@ -4,7 +4,7 @@
 \title{ Click }
 
 \description{
-  Click on a plot (map) to get values of a Raster* object at a location; and optionally the coordinates for the location. 
+  Click on a plot (map) of a RasterLayer to get values of a Raster* object at a location; and optionally the coordinates for the location. 
   Multiple locations can be clicked on by specifying \code{n=}. 
 }
 

Modified: pkg/raster/man/draw.Rd
===================================================================
--- pkg/raster/man/draw.Rd	2009-04-12 03:26:13 UTC (rev 401)
+++ pkg/raster/man/draw.Rd	2009-04-12 16:03:59 UTC (rev 402)
@@ -5,7 +5,7 @@
 
 \title{ Draw a line or polygon on a map }
 \description{
-Draw a line or polygon on a map and save it for later use
+Draw a line or polygon on a plot (map) and save it for later use
 }
 
 \usage{

Added: pkg/raster/man/hist.Rd
===================================================================
--- pkg/raster/man/hist.Rd	                        (rev 0)
+++ pkg/raster/man/hist.Rd	2009-04-12 16:03:59 UTC (rev 402)
@@ -0,0 +1,56 @@
+\name{hist}
+
+\docType{methods}
+
+\alias{hist}
+\alias{hist,Raster-method}
+\alias{hist,RasterStack-method}
+
+
+\title{Histogram}
+
+\description{
+Create a histogram of the values of a RasterLayer. NA values are ignored. 
+}
+
+
+\usage{
+hist(x, ...) 
+}
+
+
+\arguments{
+  \item{x}{A Raster* object}
+  \item{...}{Additional arguments. See \code{?hist}}  
+}
+
+
+\section{Methods}{
+\describe{
+
+\code{hist(x, maxsamp=100000, ...)}
+
+maxsamp is the maximum number of (randomly selected) grid cells to use for creating the histogram
+
+}}
+
+
+\seealso{ \code{\link[raster]{plot}} }
+
+\examples{ 
+r1 <- raster(nrows=25, ncols=25)
+r1 <- setValues(r1, runif(ncell(r1)))
+r2 <- setValues(r1, runif(ncell(r1)))
+rs <- r1 + r2
+rp <- r1 * r2
+par(mfrow=c(2,2))
+plot(rs, main='sum')
+plot(rp, main='product')
+hist(rs, main='')
+hist(rp, main='')
+}
+
+
+\keyword{methods}
+\keyword{spatial}
+

Deleted: pkg/raster/man/map.Rd
===================================================================
--- pkg/raster/man/map.Rd	2009-04-12 03:26:13 UTC (rev 401)
+++ pkg/raster/man/map.Rd	2009-04-12 16:03:59 UTC (rev 402)
@@ -1,48 +0,0 @@
-\name{map}
-\alias{map}
-
-\title{ Map }
-
-\description{
-Plot the values of a RasterLayer
-}
-
-\usage{
-map(object, index=1, col=rev(terrain.colors(25)), subsample=TRUE, maxdim=500, addbox=TRUE, axes = TRUE, xlab="", ylab="", ...)
-}
-
-\arguments{
-  \item{object}{RasterLayer object}
-  \item{index}{Ignored for RasterLayers. The index of a raster in a RasterStack  1 <= index <= nlayers(rstack) }
-  \item{col}{A color palette, i.e. a vector of n contiguous colors such as \code{rainbow}, \code{heat.colors}, and \code{topo.colors}, on one or your own making}
-  \item{subsample}{Logical. If \code{TRUE}, the image is resampled using maxdim}
-  \item{maxdim}{Maximum requested number of pixels in the map display (either vertical or horizontal) }
-  \item{addbox}{Logical. If \code{TRUE} a box is drawn around the map } 
-  \item{axes}{see "?image"}
-  \item{xlab}{see "?image"}
-  \item{ylab}{see "?image"}
-  \item{...}{For plot/map: Any argument that can be passed to image.plot(fields) and to image(graphics)} 
-   }
-\details{
-  If \code{subsample=FALSE}, then \code{maxdim} is ingored. Subsampled maps are made by skipping rows and columns. This is always 
-  done in a regular pattern (e.g. skip every second row). For this reason, the actual number of pixels when \code{subsample = TRUE}
-  is generally not exactely the same as \code{maxdim}. If \code{maxdim} is close to the largest dimension of the raster data matrix 
-  it does not affect it. It needs to be 0.75 times the largest raster dimension to have an effect, in which case the number of pixels
-  will be 0.5 times the largest dimension times the smallest dimension.  
-  
-  map is called when plot() is used with a Raster* object
-  Most of this function was taken from image.plot (fields package)
-}
-
-
-\author{ Robert J. Hijmans }
-
-\examples{ 
-	rs <- raster()
-	rs <- setValues(rs, runif(ncell(rs)))
-	map(rs)
-	rsa <- aggregate(rs, fact=10, fun=max)
-	map(rsa)
- }
-
-\keyword{ spatial }

Deleted: pkg/raster/man/plot-methods.Rd
===================================================================
--- pkg/raster/man/plot-methods.Rd	2009-04-12 03:26:13 UTC (rev 401)
+++ pkg/raster/man/plot-methods.Rd	2009-04-12 16:03:59 UTC (rev 402)
@@ -1,46 +0,0 @@
-\name{plot}
-
-\docType{methods}
-
-\alias{plot,BoundingBox,ANY-method}
-\alias{lines}
-\alias{lines,BoundingBox-method}
-\alias{plot,BoundingBox,missing-method}
-\alias{plot,Raster,missing-method}
-\alias{plot,Raster,numeric-method}
-\alias{plot,RasterLayer,RasterLayer-method}
-\alias{hist,Raster-method}
-\alias{hist,RasterStack-method}
-
-
-\title{Methods for Function plot in Package `raster'}
-
-\description{
- Methods for function \code{plot} in Package `raster'
- 
- \code{plot} can also be supplied with an additional numeric argument indicating the layer in a RasterStack object that should be plotted (mapped)
- \code{plot} can also be supplied with the two RasterLayer objects, creating a scatter plot (if they have matching extent and resolution)
-
-}
-
-\section{Methods}{
-\describe{
-
-Methods for function \code{plot}
-
-\item{x = "Raster", y = "missing"}{creates a plot of raster values; see \code{\link[raster]{map}}  }
-
-\item{x = "Raster", y = "numeric"}{ creates a plot (map) of raster values. The second argument is the layer to be shown for multlayer Raster* objects  }
-
-\item{x = "RasterLayer", y = "RasterLayer"}{ xy plot of RasterLayer values }
-
-\item{x = "BoundingBox", y = "ANY"}{ plot a BoundingBox object }
-
-Methods for function \code{hist}
-\item{x = "RasterLayer"}{ histogram for RasterLayer }
-
-}}
-
-\keyword{methods}
-\keyword{spatial}
-

Added: pkg/raster/man/plot.Rd
===================================================================
--- pkg/raster/man/plot.Rd	                        (rev 0)
+++ pkg/raster/man/plot.Rd	2009-04-12 16:03:59 UTC (rev 402)
@@ -0,0 +1,71 @@
+\name{plot}
+
+\docType{methods}
+
+\alias{plot,Raster,missing-method}
+\alias{plot,Raster,numeric-method}
+\alias{plot,RasterLayer,RasterLayer-method}
+
+\title{Plot a Raster* object}
+
+\description{
+Plot (that is, make a map of) the values of a RasterLayer or RasterStack, or make a scatterplot of their values.
+}
+
+
+\section{Methods}{
+\describe{
+\bold{x=RasterLayer, y=numeric or missing}
+
+\code{plot(x, y=1, col=rev(terrain.colors(25)), subsample=TRUE, maxdim=500, addbox=TRUE, axes = TRUE, xlab="", ylab="", ...)}
+
+\tabular{rll}{
+\tab \code{x} \tab a RasterLayer object \cr
+\tab \code{y} \tab The index of a raster in a RasterStack  1 <= index <= nlayers(rstack); Ignored for RasterLayer objects \cr
+\tab \code{col}  \tab  A color palette, i.e. a vector of n contiguous colors such as \code{rainbow}, \code{heat.colors}, and \code{topo.colors}, on one or your own making \cr
+\tab \code{subsample}  \tab  Logical. If \code{TRUE}, the image is resampled using maxdim \cr
+\tab \code{maxdim}  \tab  Maximum requested number of pixels in the map display (either vertical or horizontal)  \cr
+\tab \code{addbox}  \tab  Logical. If \code{TRUE} a box is drawn around the map \cr
+\tab \code{axes}  \tab  see \code{?image} \cr
+\tab \code{xlab}  \tab  see \code{?image} \cr
+\tab \code{ylab}  \tab  see \code{?image} \cr
+\tab \code{...}  \tab  Any argument that can be passed to \code{\link[fields]{image.plot}} and to \code{\link[graphics]{plot}}  \cr
+}
+
+
+\bold{x=RasterLayer, y=RasterLayer}
+Produces a scatter plot of the values of x against those of y. 
+\code{plot(x, y, maxdim=10000, cex=0.1, ...) }
+
+\tabular{rll}{
+\tab \code{x} \tab a RasterLayer object \cr
+\tab \code{y} \tab a RasterLayer object \cr
+\tab \code{maxdim}  \tab  Maximum requested number of pixels in the map display (either vertical or horizontal)  \cr
+\tab \code{cex}  \tab  point size \cr
+\tab \code{...}  \tab  Any argument that can be passed to \code{\link[graphics]{plot}}  \cr
+}
+}}
+
+
+\details{
+  If \code{subsample=FALSE}, then \code{maxdim} is ingored. Subsampled maps are made by skipping rows and columns. This is always 
+  done in a regular pattern (e.g. skip every second row). For this reason, the actual number of pixels when \code{subsample = TRUE}
+  is generally not exactely the same as \code{maxdim}. If \code{maxdim} is close to the largest dimension of the raster data matrix 
+  it does not affect it. It needs to be 0.75 times the largest raster dimension to have an effect, in which case the number of pixels
+  will be 0.5 times the largest dimension times the smallest dimension.  
+  
+  Most of the code for this function was taken from image.plot (fields package)
+}
+
+
+\author{ Robert J. Hijmans }
+
+\examples{ 
+r <- raster(nrows=36, ncols=18)
+r <- setValues(r, runif(ncell(r)))
+plot(r)
+}
+
+\keyword{methods}
+\keyword{spatial}
+

Added: pkg/raster/man/plotBbox.Rd
===================================================================
--- pkg/raster/man/plotBbox.Rd	                        (rev 0)
+++ pkg/raster/man/plotBbox.Rd	2009-04-12 16:03:59 UTC (rev 402)
@@ -0,0 +1,37 @@
+\name{plotBbox}
+
+\docType{methods}
+
+\alias{plot,BoundingBox,ANY-method}
+\alias{plot,BoundingBox,missing-method}
+
+
+\title{Methods for Function plot in Package `raster'}
+
+\description{
+ Methods for function \code{plot} in Package `raster'
+ 
+ \code{plot} can also be supplied with the two RasterLayer objects, creating a scatter plot (if they have matching extent and resolution)
+
+}
+
+\section{Methods}{
+\describe{
+
+Methods for function \code{plot}
+
+\item{x = "Raster", y = "missing"}{creates a plot of raster values; see \code{\link[raster]{map}}  }
+
+\item{x = "RasterLayer", y = "RasterLayer"}{ xy plot of RasterLayer values }
+
+\item{x = "BoundingBox", y = "ANY"}{ plot a BoundingBox object }
+
+}}
+
+
+\seealso{ \code{\link[raster]{plot}} }
+
+
+\keyword{methods}
+\keyword{spatial}
+

Modified: pkg/raster/man/setDatatype.Rd
===================================================================
--- pkg/raster/man/setDatatype.Rd	2009-04-12 03:26:13 UTC (rev 401)
+++ pkg/raster/man/setDatatype.Rd	2009-04-12 16:03:59 UTC (rev 402)
@@ -28,7 +28,7 @@
 The following datatypes are available.
 
 \tabular{rll}{
-\bold{datatype \tab min \tab max} \cr
+\bold{datatype} \tab \bold{min} \tab \bold{max} \cr
 \code{LOG1S} \tab FALSE (0)\tab TRUE (1) \cr
 \code{INT1S} \tab -127 \tab  127 \cr
 \code{INT1U} \tab 0 \tab  255 \cr



More information about the Raster-commits mailing list