diff --git a/DESCRIPTION b/DESCRIPTION index a5330a4..a7660a2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -26,8 +26,8 @@ URL: https://github.com/hrbrmstr/ggalt BugReports: https://github.com/hrbrmstr/ggalt/issues Encoding: UTF-8 Depends: - R (>= 3.0.0), - ggplot2 (>= 2.2.0) + R (>= 3.2.0), + ggplot2 (>= 2.2.1) Suggests: testthat, gridExtra, diff --git a/R/coord_proj.r b/R/coord_proj.r index 0e56281..9a9b61c 100644 --- a/R/coord_proj.r +++ b/R/coord_proj.r @@ -45,7 +45,7 @@ #' world <- world[world$region != "Antarctica",] #' #' gg <- ggplot() -#' gg <- gg + geom_map(data=world, map=world, +#' gg <- gg + geom_cartogram(data=world, map=world, #' aes(x=long, y=lat, map_id=region)) #' gg <- gg + coord_proj("+proj=wintri") #' gg @@ -55,7 +55,7 @@ #' usa <- usa[!(usa$subregion %in% c("Alaska", "Hawaii")),] #' #' gg <- ggplot() -#' gg <- gg + geom_map(data=usa, map=usa, +#' gg <- gg + geom_cartogram(data=usa, map=usa, #' aes(x=long, y=lat, map_id=region)) #' gg <- gg + coord_proj( #' paste0("+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=37.5 +lon_0=-96", @@ -66,7 +66,7 @@ #' greenland <- world[world$region == "Greenland",] #' #' gg <- ggplot() -#' gg <- gg + geom_map(data=greenland, map=greenland, +#' gg <- gg + geom_cartogram(data=greenland, map=greenland, #' aes(x=long, y=lat, map_id=region)) #' gg <- gg + coord_proj( #' paste0("+proj=stere +lat_0=90 +lat_ts=70 +lon_0=-45 +k=1 +x_0=0", diff --git a/R/geom_cartogram.r b/R/geom_cartogram.r index b82c8d2..bbac09e 100644 --- a/R/geom_cartogram.r +++ b/R/geom_cartogram.r @@ -4,7 +4,18 @@ #' \code{x} and \code{y} aesthetics. #' #' @section Aesthetics: -#' \aesthetics{geom}{cartogram} +#' \code{geom_cartogram} understands the following aesthetics (required aesthetics are in bold): +#' \itemize{ +#' \item \code{\strong{map_id}} +#' \item \code{alpha} +#' \item \code{colour} +#' \item \code{fill} +#' \item \code{group} +#' \item \code{linetype} +#' \item \code{size} +#' \item \code{x} +#' \item \code{y} +#' } #' #' @export #' @param map Data frame that contains the map coordinates. This will diff --git a/man/coord_proj.Rd b/man/coord_proj.Rd index 317296b..d405c3c 100644 --- a/man/coord_proj.Rd +++ b/man/coord_proj.Rd @@ -62,7 +62,7 @@ world <- map_data("world") world <- world[world$region != "Antarctica",] gg <- ggplot() -gg <- gg + geom_map(data=world, map=world, +gg <- gg + geom_cartogram(data=world, map=world, aes(x=long, y=lat, map_id=region)) gg <- gg + coord_proj("+proj=wintri") gg @@ -72,7 +72,7 @@ usa <- world[world$region == "USA",] usa <- usa[!(usa$subregion \%in\% c("Alaska", "Hawaii")),] gg <- ggplot() -gg <- gg + geom_map(data=usa, map=usa, +gg <- gg + geom_cartogram(data=usa, map=usa, aes(x=long, y=lat, map_id=region)) gg <- gg + coord_proj( paste0("+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=37.5 +lon_0=-96", @@ -83,7 +83,7 @@ gg greenland <- world[world$region == "Greenland",] gg <- ggplot() -gg <- gg + geom_map(data=greenland, map=greenland, +gg <- gg + geom_cartogram(data=greenland, map=greenland, aes(x=long, y=lat, map_id=region)) gg <- gg + coord_proj( paste0("+proj=stere +lat_0=90 +lat_ts=70 +lon_0=-45 +k=1 +x_0=0", diff --git a/man/geom_cartogram.Rd b/man/geom_cartogram.Rd index 5c14e3c..c5b6735 100644 --- a/man/geom_cartogram.Rd +++ b/man/geom_cartogram.Rd @@ -58,7 +58,18 @@ This replicates the old behaviour of \code{geom_map()}, enabling specifying of } \section{Aesthetics}{ -\aesthetics{geom}{cartogram} +\code{geom_cartogram} understands the following aesthetics (required aesthetics are in bold): +\itemize{ + \item \code{\strong{map_id}} + \item \code{alpha} + \item \code{colour} + \item \code{fill} + \item \code{group} + \item \code{linetype} + \item \code{size} + \item \code{x} + \item \code{y} +} } \examples{