quick.map: Quick Map

Description Usage Arguments Details Value Author(s) Examples

View source: R/quick.map.r

Description

quick.map creates and displays an image, identifying the threshold as the background color, and create the gradient legend in the map.

Usage

1
2
quick.map(sdm.asc, threshold, bkgd.col = "grey", cols = heat.colors(100),
  zlim = NULL, pnts = NULL, ...)

Arguments

sdm.asc

an object of class 'asc' (adehabitat package), 'RasterLayer' (raster package) or 'SpatialGridDataFrame' (sp package)

threshold

to indicate the threshold limit of sdm.asc

bkgd.col

to specify the background color

cols

a set of 2 or more colors to be used in the image and the gradient legend

zlim

to specify the upper an lower limits, which are going to be the labels of the gradient legend

pnts

location information for adding the legend.gradient

...

other graphical parameters defined by image() or plot()

Details

An image is created of the map requested. A gradient legend (legend.gradient) will be added if pnts (the position of the legend) is specified.

Value

Nothing is returned, an image is created.

Author(s)

Lorena Falconi lorefalconi@gmail.com

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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#create a matrix
tmat = { matrix(c( 0,0,0,1,0,0,1,1,0,1,
                   0,0,1,0,1,0,0,0,0,0,
                   0,1,NA,1,0,1,0,0,0,1,
                   1,0,1,1,1,0,1,0,0,1,
                   0,1,0,1,0,1,0,0,0,1,
                   0,0,1,0,1,0,0,1,1,0,
                   1,0,0,1,0,0,1,0,0,0,
                   0,1,0,0,0,1,0,0,0,1,
                   0,0,1,1,1,0,0,1,1,1,
                   1,1,1,0,0,0,0,1,1,1),nr=10,byrow=TRUE) }

#do the connected component labeling
tasc = ConnCompLabel(tmat)

#put in the gradient scale
pnts = cbind(x =c(1.1,1.2,1.2,1.1), y =c(0.9,0.9,0.7,0.7))

# Set the map and gradient leyend colors
tasc.col=colorRampPalette(c("yellow","orange", "red"))(5)

#Create an image with the gradient legend
quick.map(tasc,0.09,bkgd.col = 'darkgrey', cols=tasc.col,
    axes=FALSE, xlim=c(0.0,1.35))

#########################
# Create an image with two colors: below the threshold and
# above the threshold

# The next version of SDM Tools will let you create the legend.gradient
# at a specific side of your image, and the user would not need to set
# the coordinates.

# To create the legend.gradient at the bottom left of your image without
# setting up the coordinates at the image you can do this:

xlim = c(-0.5,1)
ylim = c(0,1)
wid = diff(xlim)*0.05
ht = diff(ylim)*0.1
xvals = c(xlim[1]+wid,xlim[1]+2*wid,xlim[1]+2*wid,xlim[1]+wid)
yvals = c(ylim[1]+ht,ylim[1]+ht,ylim[1]+2*ht,ylim[1]+2*ht)

#Create the points for the legend.gradient
pnts=(cbind(xvals,yvals))

# Set the images colors: above the threshold is black and
# below the threshold is darkgrey.
quick.map(tasc,0.09,bkgd.col = 'darkgrey', cols="black",
    axes=FALSE, xlim=c(-0.8, 1))

SDMTools documentation built on Jan. 11, 2020, 9:23 a.m.

Related to quick.map in SDMTools...