panel.patch: panel.patch

View source: R/panel.patch.R

panel.patchR Documentation

panel.patch

Description

panel.patch

Usage

panel.patch(
  x,
  y = NULL,
  density = NULL,
  angle = 45,
  border = NULL,
  col = NA,
  lty = par("lty"),
  fill = NA,
  fillOddEven = FALSE,
  ...
)

panel.patch.list(lst, ...)

panel.poly_grid(s, density = 0.1, angle = 45, border = NULL, ...)

panel.polygonsplot2(
  x,
  y,
  z,
  subscripts,
  ...,
  density = 0.2,
  angle = 45,
  col = "grey65",
  lwd = 0.5,
  lty = 1,
  poly_shade,
  sp.layout
)

panel.gridplot2(
  x,
  y,
  z,
  subscripts,
  ...,
  density = 0.2,
  angle = 45,
  col = "grey65",
  lwd = 0.5,
  lty = 1,
  poly_shade,
  sp.layout
)

Arguments

x, y

vectors containing the coordinates of the vertices of the polygon.

density

the density of shading lines, in lines per inch. The default value of NULL means that no shading lines are drawn. A zero value of density means no shading nor filling whereas negative values and NA suppress shading (and so allow color filling).

angle

the slope of shading lines, given as an angle in degrees (counter-clockwise).

border

the color to draw the border. The default, NULL, means to use par("fg"). Use border = NA to omit borders.

For compatibility with S, border can also be logical, in which case FALSE is equivalent to NA (borders omitted) and TRUE is equivalent to NULL (use the foreground colour),

col

the color for filling the polygon. The default, NA, is to leave polygons unfilled, unless density is specified. (For back-compatibility, NULL is equivalent to NA.) If density is specified with a positive value this gives the color of the shading lines.

lty

the line type to be used, as in par.

fillOddEven

logical controlling the polygon shading mode: see below for details. Default FALSE.

...
  • panel.patch : other parameters to polygon.fullhatch;

  • panel.patch.list: other parameters to panel.patch()

lst

List of coordinates matrix ⁠[x, y]⁠

Details

shadePattern can be set by set_options(list(shadePattern = list(col = "black", lty = 1, lwd = 2)))

  • panel.gridplot2: SpatialPixels or SpatialGrid

  • panel.polygonsplot2: SpatialPolygon

Author(s)

XiHui Gu and Dongdong Kong

See Also

graphics::polygon()

Examples

## Not run: 
library(sf2)
library(sp)
# library(grid)

range <- c(70, 140, 15, 55) # Tibetan Plateau
r  <- get_grid(range, cellsize = 1/2, midgrid = TRUE)

# set.seed(1)
I <- c(1:2000, 4000:6000)
poly   <- as(r[I, ], "SpatialPolygonsDataFrame")
poly2  <- union_polygon(poly)

# set_options works for
set_options(list(shadePattern = list(col = "black", lty = 1, lwd = 2)))

print(spplot(poly2 , poly_shade = poly2,
             panel = panel.polygonsplot2,
             density = 0.1, angle = 45,
             fill = "grey", col = "red"))
print(spplot(r[I, ], poly_shade = poly2, panel = panel.gridplot2,
             fill = "grey", col = "red"))

## End(Not run)

kongdd/latticeGrob documentation built on March 30, 2024, 3:35 a.m.