Learn R Programming

geo (version 1.4-3)

geoSR: Plot Squares in Different Colors

Description

Plot Icelandic statistical squares in different colors, based on specified levels.

Usage

geoSR(sr, z, levels, grid = FALSE, ...)

Arguments

sr
squares or subsquares.
z
values for each square.
levels
threshold levels for splitting the values into categories.
grid
passed to geoplot.
...
passed to geoplot.

Value

Invisible NULL.

Details

If levels is a named vector, the names are used as level-specific colors, ignoring the last element.

The levels should go lower and higher than the range of z values.

See Also

geoplot and reitaplott are the underlying drawing functions.

colorRampPalette can be used to create a ramp of level-specific colors.

Examples

Run this code
# Use existing palette
geoSR(561:560, c(0.3,3), levels=c(0,1,10))

# Pass colors along with levels
lev <- c(0, 1, 10)
names(lev) <- c("brown", "orange", NA)
geoSR(561:560, c(0.3,3), lev)

# Subsquares
geoSR(5611:5612, c(0.3,3), lev)

# Color ramp
z <- (0:10) / 10
lev <- (0:10) / 10
ramp <- colorRampPalette(c("khaki1","gold","orange","darkorange2","red",
                           "darkred","black"))
names(lev) <- ramp(length(lev))
geoSR(724:715, z, lev)

Run the code above in your browser using DataLab