| panel.patch | R Documentation | 
panel.patch
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
)
| 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  | 
| angle | the slope of shading lines, given as an angle in degrees (counter-clockwise). | 
| border | the color to draw the border.  The default,  For compatibility with S,  | 
| col | the color for filling the polygon. The default,
 | 
| lty | the line type to be used, as in  | 
| fillOddEven | logical controlling the polygon shading mode:  see
below for details.  Default  | 
| ... | 
 | 
| lst | List of coordinates matrix  | 
shadePattern can be set by set_options(list(shadePattern = list(col = "black", lty = 1, lwd = 2)))
panel.gridplot2: SpatialPixels or SpatialGrid
panel.polygonsplot2: SpatialPolygon
XiHui Gu and Dongdong Kong
graphics::polygon()
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.