pretty: Find Nice Grid Spacing

prettyR Documentation

Find Nice Grid Spacing

Description

Find nice interval in grid schema.

Usage

## S4 method for signature 'Extent'
pretty(x, resolution, add = 0, mar = c(0,0,0,0), verbose = FALSE, ...)

Arguments

x

⁠Extent⁠ or ⁠Spatial*⁠ object.

resolution

Character. One of ⁠"GRID"⁠ or ⁠"CELL"⁠, see floragrid for details.

add

Integer. Number of bordering rectangles of grid units (resolution ⁠GRID⁠) or grid cells (resolution ⁠CELL⁠) around computed extent.

mar

Integer vector. Numerical vector of the form ⁠c(bottom, left, top, right)⁠ which gives the number of rows or columns of grid units (resolution ⁠GRID⁠) or grid cells (resolution ⁠CELL⁠) to be added on the four sides of the extent; in addition to the value (already) specified by argument ⁠add⁠. In this way it is possible to create asymmetric extent shapes, e.g. widen the extent on a particular side.

...

Not used.

verbose

Print used resultion.

Details

The function helps in setting up an appropriate grid with options to add additional strips of grid units systematically at all sides (argument ⁠add⁠) or at specified margins (⁠mar⁠). Arguments can be combined.

Value

⁠Exent⁠ object.

Author(s)

Roland Kaiser

See Also

floragrid

Examples

# initial extent 	
e0 <- extent(12.8,15.3,46.8,48.3)

# default is to use resolution GRID
pretty(e0)

# versions using resolution GRID
e1 <- pretty(e0, "GRID")
e2 <- pretty(e0, "GRID", add = 2)
e3 <- pretty(e2, "GRID", add = 0, mar = c(1,2,3,4))

# additional strips of gridcells at
# bottom (1), left (2), top (3), and right (4), black
plot(floragrid(e3, resolution = "GRID"),
    border = "white", col = "black")

# pretty spacing of extent plus 2 "rings" of encompassing cells, red
plot(floragrid(e2, resolution = "GRID"),
    border = "red", col = "white", add = TRUE)

# pretty spacing of extent, green
plot(floragrid(e1, resolution = "GRID"),
    border = "green", col = "gray", add = TRUE)

# initial (input) extent, blue
plot(extent2polygon(e0),
    border = "blue", lwd = 2, add = TRUE)

# add axes to plot
axis(1)
axis(2)



kardinal-eros/sabotag-tools documentation built on Feb. 6, 2025, 1:12 a.m.