Browse Source

theme improvements that include not relying on dev versions ggplot2

master
boB Rudis 5 years ago
parent
commit
2bd48125d2
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 8
      DESCRIPTION
  2. 12
      R/theme-statebin.R

8
DESCRIPTION

@ -7,7 +7,11 @@ Authors@R: c(
person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-5670-2640")),
person("Harold", "Gil", email = "hgil@marionhealth.org", role = "ctb",
comment = "fix for show.guide")
comment = "fix for show.guide"),
person("Brian", "Adams", email = "btadams478@gmail.com", role = "ctb",
comment = "theme testing & feedback"),
person("Thomas", "Wood", role = "ctb",
comment = "Significant suggestions & testing that made new features possible")
)
Maintainer: Bob Rudis <bob@rud.is>
Description: Cartogram heatmaps are an alternative to choropleth maps for 'USA' States
@ -28,7 +32,7 @@ Suggests:
Depends:
R (>= 3.2.0),
Imports:
ggplot2 (>= 2.2.1.9000),
ggplot2 (>= 2.2.1),
scales (>= 0.5.0),
grid
RoxygenNote: 6.0.1

12
R/theme-statebin.R

@ -11,8 +11,16 @@ theme_statebins <- function(legend_position="bottom",
base_line_size = base_size/22,
base_rect_size = base_size/22) {
gg <- theme_bw(base_family = base_family, base_size = base_size,
if ("base_line_size" %in% names(formals(ggplot2::theme_bw))) {
gg <- theme_bw(base_family = base_family, base_size = base_size,
base_line_size = base_line_size, base_rect_size = base_rect_size)
} else {
gg <- theme_bw(base_family = base_family, base_size = base_size)
gg <- gg + theme(size = base_line_size)
gg <- gg + theme(rect = element_rect(fill = "white", colour = "black",
size = base_rect_size, linetype = 1))
}
gg <- gg + theme(panel.border=element_blank())
gg <- gg + theme(strip.background = element_rect(color="#2b2b2b", fill="white"))
gg <- gg + theme(panel.grid=element_blank())
@ -22,6 +30,8 @@ theme_statebins <- function(legend_position="bottom",
gg <- gg + theme(plot.title=element_text(hjust=0.5))
gg <- gg + theme(axis.title.x=element_text(hjust=0.5))
gg <- gg + theme(legend.position=legend_position)
gg <- gg + theme(plot.title=element_text(size=16, hjust=0))
gg <- gg + theme(plot.margin = margin(30,30,30,30))
gg
}

Loading…
Cancel
Save