grid.image: Simple plot of interpolated grid.

Description Usage Arguments Details Note Author(s) See Also Examples

View source: R/grid.image.R

Description

Plots the interpolated grid.

Usage

1
2
3
grid.image(intpl, grid, breaks=10, ic=1, colFUN=heat.colors, 
           main=colnames(intpl)[ic], xlab=colnames(grid)[1], 
           ylab=colnames(grid)[2], sclab=NA, ...)

Arguments

intpl

A matrix or vector with interpolation results.

grid

A table containing longitude and latitude of interpolated locations.

breaks

Number of breaks in the scale.

ic

Column index or name from 'intpl' table to show. Defaults to the first column. Can be used to plot standard deviation or any other column. This value is ignored of 'intpl' is a vector.

colFUN

Function to process colors. Can be any of R base color functions (e.g. rainbow, terrain.colors, etc) or user defined function.

main

Main title.

xlab

X axis label. Defaults to name of the first 'grid' column.

ylab

Y axis label. Defaults to name of the secont 'grid' column.

sclab

Scale label to plot under the scale bar.

...

Futher arguments to be passed to par. Most used is 'cex' to control the font size.

Details

This function may be used to produce a simple plot of the interpolated grid. It has some customizable features and it plots a scale bar of the Z values shown.

Note

Does not work with multiple plots (e.g. with 'layout').

Author(s)

Pedro Tarroso <ptarroso@cibio.up.pt>

See Also

image krig idw

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
    data(vipers)
    data(d.gen)

    # create a grid of the sampled area for inteprolation
    grid <- expand.grid(x=seq(-9.5,3,0.25), y=seq(36, 43.75, 0.25))

    # create a distance matrix between samples
    r.dist <- dist(vipers[,1:2])

    # fit a model with defaults (shperical model) and estimation of range
    gv <- gen.variogram(r.dist, d.gen, 0.25)
    gv <- gv.model(gv)

    # interpolation of the distances to first sample with ordinary kriging
    int.krig <- krig(d.gen[,1], vipers[,1:2], grid, gv)

    #plot the interpolation results
    grid.image(int.krig, grid, main='Krigging Interpolation', 
               xlab='Longitude',ylab = 'Latitude', 
               sclab=paste('Genetic distance to sample', 
               colnames(d.gen)[1]))

    # User can add extra elements to the main plot.
    points(vipers[,1:2], cex=d.gen[,1]*15+0.2) 

phylin documentation built on Dec. 12, 2019, 5:07 p.m.