R/plot.cartogramR.R

Defines functions plot.cartogramR

Documented in plot.cartogramR

#' Plot a cartogram object
#'
#' @param x a cartogram object
#'
#' @param   \\dots arguments passed to or from other methods.
#' @return No return value, called for side effects
#'
#' @export
#' @examples
#' \donttest{
#'   data(usa)
#'   carto <- cartogramR(usa, "electors64")
#'   plot(carto)
#' }
#'
#' @import sf
#' @md
plot.cartogramR <- function(x, ...) {
 if  (!inherits(x, "cartogramR")) stop(paste(deparse(substitute(x)), "must be a cartogramR object"))
 x <- sf::st_geometry(x$cartogram)
 plot(x, ...)
 return(invisible(NULL))
}

Try the cartogramR package in your browser

Any scripts or data that you put into this service are public.

cartogramR documentation built on Sept. 11, 2024, 5:48 p.m.