trigrid
, hexagrid
or facelayer
classesThis function will invoke the plot
method of the sf
or the SpatialPolygons
class.
The function passes arguments to the plot method of the SpatialPolygons
class. In case a heatmap is plotted and the plotting device gets resized,
some misalignments can happen. If you want to use a differently sized window, use x11
to set the height and width before running the function.
The function matches data referred to the grid and plots it with sf's plotting methods.
plot# S4 method for trigrid,ANY
plot(x, crs = NULL, ...)
# S4 method for facelayer,ANY
plot(
x,
crs = NULL,
col = "heat",
border = NA,
alpha = NULL,
frame = FALSE,
legend = TRUE,
breaks = NULL,
inclusive = TRUE,
discrete = FALSE,
...
)
# S4 method for trigrid,vector
plot(x, y, crs = NULL, main = "", ...)
# S4 method for trigrid,table
plot(x, y, crs = NULL, main = "", ...)
The function has no return value.
An object of class standardGeneric
of length 1.
(trigrid
, hexagrid
or facelayer
) The object to be plotted.
(character
or crs
) A coordinate system for the transformation of coordinates.
Arguments passed to the plot
function.
(character
) Colors passed to a colorRamp
in case of the facelayer
contains logical
values, a single value is required (defaults to "red"
).
(character
) Specifies the color of the borders of the cells.
(character
) Two digits for the fill colors, in hexadecimal value between 0
and 255
.
(logical
) If TRUE
the grid boundaries will be drawn with black.
(logical
): Should the legend be plotted?
(numeric
) The number of breakpoints between the plotted levels. The argument is passed to the cut
function.
(logical
): If there are values beyond the limits of breaks, should these be represented in the plot (TRUE
) or left out completely FALSE
?
(logical
): Do the heatmaps symbolize a discrete or a continuous variable? This argument only affects the legend of the heatmap.
A named vector or table with names that refer to face names of the grid.
The main title of the plot
# A simple grid, with sf-representation
gr <- hexagrid(4, sf=TRUE)
dat <- 1:nrow(gr@faces)
names(dat) <- paste0("F", dat)
plot(x=gr, y=dat)
Run the code above in your browser using DataLab