Browse Source

minor geom cleanup

master
boB Rudis 5 years ago
parent
commit
45f9eda480
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 5
      DESCRIPTION
  2. 2
      NAMESPACE
  3. 4
      R/geom-rrect.r
  4. 4
      R/geom-rtile.R
  5. 3
      R/statebins-package.R
  6. 4
      R/util.R

5
DESCRIPTION

@ -1,7 +1,7 @@
Package: statebins
Type: Package
Title: Create 'U.S.' Uniform Square State Cartogram Heatmaps
Version: 1.3.0
Version: 1.3.1
Date: 2017-11-14
Authors@R: c(
person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre"),
@ -29,7 +29,8 @@ Depends:
R (>= 3.2.0),
Imports:
ggplot2 (>= 2.2.1.9000),
scales (>= 0.5.0)
scales (>= 0.5.0),
grid
RoxygenNote: 6.0.1
Collate:
'aaa.R'

2
NAMESPACE

@ -24,6 +24,7 @@ importFrom(ggplot2,guides)
importFrom(ggplot2,labs)
importFrom(ggplot2,layer)
importFrom(ggplot2,rel)
importFrom(ggplot2,resolution)
importFrom(ggplot2,scale_color_manual)
importFrom(ggplot2,scale_fill_brewer)
importFrom(ggplot2,scale_fill_manual)
@ -32,4 +33,5 @@ importFrom(ggplot2,scale_y_continuous)
importFrom(ggplot2,scale_y_reverse)
importFrom(ggplot2,theme)
importFrom(ggplot2,theme_bw)
importFrom(grid,unit)
importFrom(scales,alpha)

4
R/geom-rrect.r

@ -8,7 +8,7 @@ geom_rrect <- function(mapping = NULL, data = NULL,
data = data,
mapping = mapping,
stat = stat,
geom = GeomRect,
geom = GeomRrect,
position = position,
show.legend = show.legend,
inherit.aes = inherit.aes,
@ -32,7 +32,7 @@ GeomRrect <- ggplot2::ggproto("GeomRrect", ggplot2::Geom,
coords$xmin[i], coords$ymax[i],
width = (coords$xmax[i] - coords$xmin[i]),
height = (coords$ymax[i] - coords$ymin)[i],
r=unit(0.3, "snpc"),
r=grid::unit(0.3, "snpc"),
default.units = "native",
just = c("left", "top"),
gp = grid::gpar(

4
R/geom-rtile.R

@ -23,8 +23,8 @@ GeomRtile <- ggplot2::ggproto("GeomRtile", GeomRrect,
extra_params = c("na.rm", "width", "height"),
setup_data = function(data, params) {
data$width <- data$width %||% params$width %||% resolution(data$x, FALSE)
data$height <- data$height %||% params$height %||% resolution(data$y, FALSE)
data$width <- data$width %||% params$width %||% ggplot2::resolution(data$x, FALSE)
data$height <- data$height %||% params$height %||% ggplot2::resolution(data$y, FALSE)
transform(data,
xmin = x - width / 2, xmax = x + width / 2, width = NULL,

3
R/statebins-package.R

@ -4,11 +4,12 @@
#' @name statebins-package
#' @docType package
#' @author Bob Rudis (bob@@rud.is)
#' @importFrom grid unit
#' @importFrom scales alpha
#' @importFrom ggplot2 ggplot geom_tile scale_fill_manual guides geom_tile ggplotGrob
#' @importFrom ggplot2 geom_point geom_text scale_color_manual guides theme labs
#' @importFrom ggplot2 scale_x_continuous scale_y_continuous coord_equal theme_bw
#' @importFrom ggplot2 aes element_rect element_blank element_text
#' @importFrom ggplot2 aes element_rect element_blank element_text resolution
#' @importFrom ggplot2 aes_string aes_ scale_y_reverse layer GeomRect
#' @importFrom ggplot2 scale_fill_brewer ggtitle rel ggproto draw_key_polygon Geom Stat
NULL

4
R/util.R

@ -32,4 +32,6 @@ validate_states <- function(state_data, state_col, merge.x) {
}
"%||%" <- function(a, b) { if (!is.null(a)) a else b }
"%||%" <- function(a, b) { if (!is.null(a)) a else b }
.pt <- 2.84527559055118
Loading…
Cancel
Save