From d33ce94032eb9a641db76d0c1b65caf41d965216 Mon Sep 17 00:00:00 2001 From: Spencer Fox Date: Tue, 24 Oct 2017 16:49:33 -0500 Subject: [PATCH 1/3] adding in simple map theme --- R/themes.R | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/R/themes.R b/R/themes.R index bee1512..8043c0f 100644 --- a/R/themes.R +++ b/R/themes.R @@ -154,6 +154,25 @@ theme_nothing <- function(base_size = 14, base_family = ""){ ) } +#' Create a completely empty theme +#' +#' The theme created by this function is useful for plotting maps with cowplot defaults. Differs from `theme_nothing()` by preserving legends and facetting ability. +#' @param base_size Overall font size. Default is 14. +#' @param base_family Base font family. +#' @return The theme. +#' @examples +#' usa_data = map_data("usa") +#' ggplot(usa_data, aes(long,lat,group=region)) + geom_polygon() + theme_map() +#' ggplot(usa_data, aes(long,lat, fill = region)) + geom_polygon() + theme_map() +#' ggplot(usa_data, aes(long,lat, fill = region)) + facet_wrap(~region, scales = "free") + geom_polygon() + theme_map() +#' @export +theme_map <- function(base_size = 14, base_family = ""){ + # work based off of theme_void + theme_void(base_size = base_size, base_family = base_family) +} + + + #' Add/modify/remove the background grid in a ggplot2 plot #' #' This function provides a simple way to modify the background grid in ggplot2. It From 9bc0e94e142a7a84906a4b6ac46c39aa50fce4e9 Mon Sep 17 00:00:00 2001 From: Spencer Fox Date: Tue, 24 Oct 2017 16:52:23 -0500 Subject: [PATCH 2/3] update documentation --- R/themes.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/themes.R b/R/themes.R index 8043c0f..157c256 100644 --- a/R/themes.R +++ b/R/themes.R @@ -154,9 +154,9 @@ theme_nothing <- function(base_size = 14, base_family = ""){ ) } -#' Create a completely empty theme +#' Create a theme for map plotting #' -#' The theme created by this function is useful for plotting maps with cowplot defaults. Differs from `theme_nothing()` by preserving legends and facetting ability. +#' The theme created by this function is useful for plotting maps with cowplot default sizing. #' @param base_size Overall font size. Default is 14. #' @param base_family Base font family. #' @return The theme. From aa78e0803f85c060c517c138547d1156e954377d Mon Sep 17 00:00:00 2001 From: Spencer Fox Date: Wed, 25 Oct 2017 17:17:55 -0500 Subject: [PATCH 3/3] update text formatting --- R/themes.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/themes.R b/R/themes.R index 157c256..0550ec1 100644 --- a/R/themes.R +++ b/R/themes.R @@ -162,9 +162,9 @@ theme_nothing <- function(base_size = 14, base_family = ""){ #' @return The theme. #' @examples #' usa_data = map_data("usa") -#' ggplot(usa_data, aes(long,lat,group=region)) + geom_polygon() + theme_map() -#' ggplot(usa_data, aes(long,lat, fill = region)) + geom_polygon() + theme_map() -#' ggplot(usa_data, aes(long,lat, fill = region)) + facet_wrap(~region, scales = "free") + geom_polygon() + theme_map() +#' ggplot(usa_data, aes(long, lat, group=region)) + geom_polygon() + theme_map() +#' ggplot(usa_data, aes(long, lat, fill = region)) + geom_polygon() + theme_map() +#' ggplot(usa_data, aes(long, lat, fill = region)) + facet_wrap(~region, scales = "free") + geom_polygon() + theme_map() #' @export theme_map <- function(base_size = 14, base_family = ""){ # work based off of theme_void