Learn R Programming

VoxR (version 0.5.1)

raster.proj: Create a raster image from project, level and surface

Description

Easy tool for raster image creation from projections created by the project function using level function for density discretisation with the possibility of integrating an automatic caption.

Usage

raster.proj(data, title, res, method, levels, colors, contour, classlegend, surf, dim)

Arguments

data
2d point cloud x, y, npts, nvox, npts/nvox
title
the raster's title
res
pixel resolution in the scale of the original orthonormed system
method
a character string specifying the variable of interest from the projection ("nvox", "npts" ou "ratio")
levels
a vector containing the density levels of discretisation as created by level
colors
a vector containing the colors of the density classes
contour
logical : if TRUE the contours of the density classes are drawn
classlegend
a vector of characters string containing the names of the density classes for the caption
surf
a vector containing the surface of each density class for the caption as created by the surface function
dim
a character string specifying the dimension of projection ("xy", "yz", "xz")

Value

Draw the raster image in the default R graphic device

Details

Defaults :
  • res = 1
  • levels = quantiles 0.25
  • title = ""
  • colors = c(grey, green, yellow, red)
  • contour = TRUE
  • classlegend = ""
  • surf = ""
  • dim = "xy"

References

This function use previous work from the following packages :
  • raster : Robert J. Hijmans & Jacob van Etten (2013). raster: Geographic data analysis and modeling. R package version 2.1-25. http://CRAN.R-project.org/package=raster

Examples

Run this code
data(treecloud_vox)

#- projection in xy plan

proj <- project(treecloud_vox,dim="xy")

#-computing parameters for levels and surf

nvox <- c(proj[,3])
lev_vox <- level(nvox,by="quantiles",levels=c(0.2))
surf_nvox <- surface(proj,method="nvox",levels=lev_vox,res=0.02,proportion=TRUE) 

#- drawing raster

par(mfrow=c(1,1),mai=c(1,0,1,0),omi=c(0,1,0,0))

raster.proj(proj,title="nvox",res=0.02,method="nvox",levels=lev_vox,
			colors=c("lightblue","green","yellow","red","purple"),
			contour=TRUE,surf=surf_nvox,dim="xy")

Run the code above in your browser using DataLab