Learn R Programming

rangeMapper (version 0.2-0)

plot-methods: Plot a SpatialPixelsRangeMap

Description

This is a wrapper around spplot

Arguments

palette
The name of a color palette. When NULL all the qualitative color palettes are returned.

See Also

classIntervals tkColorPalette brewer.pal

Examples

Run this code
require(rangeMapper)
dbcon = rangeMap.start(file = "test.sqlite", overwrite = TRUE, dir = tempdir() )
f = system.file(package = "rangeMapper", "extdata", "wrens", "vector_combined")
global.bbox.save(con = dbcon, bbox = f, 
	p4s = CRS("+proj=cea +lon_0=0 +lat_ts=30 +x_0=0 +y_0=0 +ellps=WGS84 +units=km +no_defs") ) 
gridSize.save(dbcon, gridSize = 200)  # cell size 2 deg
canvas.save(dbcon) 
processRanges(spdf = readOGR(f, "wrens", verbose = FALSE), con =  dbcon, ID = "sci_name")
rangeMap.save(dbcon) # species richness


# PLOTS
all = rangeMap.fetch(dbcon)
SR = rangeMap.fetch(dbcon, 'species_richness')

plot(all)
plot(SR, style = "fisher", sub = "Wrens species richness")

pal = brewer.pal.get('RdYlGn')[11:1]

plot(SR, style = "fisher", colorpalette = pal)

# if there is tcltk support choose a color palette interactively. 
if(interactive()) {
	tkColorPalette(pal = brewer.pal.get(),name  = "pal")
	plot(SR, style = "fisher", colorpalette = pal)
	}

Run the code above in your browser using DataLab