No known key found for this signature in database
GPG Key ID: 1D7529BE14E2BBA9
4 changed files with
8 additions and
8 deletions
-
R/a-geom-rect.R
-
R/geom-chicklet.R
-
R/utils-infix-helpers.R
-
tests/testthat/test-ggchicklet.R
|
|
@ -1,4 +1,4 @@ |
|
|
|
geom_rrect <- function(mapping = NULL, data = NULL, |
|
|
|
geom_rrect <- function(mapping = NULL, data = NULL, # nocov start |
|
|
|
stat = "identity", position = "identity", |
|
|
|
radius = grid::unit(6, "pt"), |
|
|
|
..., |
|
|
@ -63,4 +63,4 @@ GeomRrect <- ggplot2::ggproto( |
|
|
|
|
|
|
|
draw_key = ggplot2::draw_key_polygon |
|
|
|
|
|
|
|
) |
|
|
|
) # nocov end |
|
|
@ -68,7 +68,7 @@ geom_chicklet <- function(mapping = NULL, data = NULL, |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
draw_key_rrect <- function(data, params, size) { |
|
|
|
draw_key_rrect <- function(data, params, size) { # nocov start |
|
|
|
grid::roundrectGrob( |
|
|
|
r = params$radius, |
|
|
|
default.units = "native", |
|
|
@ -80,13 +80,13 @@ draw_key_rrect <- function(data, params, size) { |
|
|
|
lty = data$linetype %||% 1 |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} # nocov end |
|
|
|
|
|
|
|
#' ggchicklet-ggplot2-ggproto |
|
|
|
#' @format NULL |
|
|
|
#' @usage NULL |
|
|
|
#' @export |
|
|
|
GeomChicklet <- ggproto( |
|
|
|
GeomChicklet <- ggproto( # nocov start |
|
|
|
"GeomChicklet", GeomRrect, |
|
|
|
|
|
|
|
required_aes = c("x", "y"), |
|
|
@ -112,4 +112,4 @@ GeomChicklet <- ggproto( |
|
|
|
|
|
|
|
draw_key = draw_key_rrect |
|
|
|
|
|
|
|
) |
|
|
|
) # nocov end |
|
|
|
|
|
@ -1,4 +1,2 @@ |
|
|
|
`%l0%` <- function(x, y) if (length(x) == 0) y else x |
|
|
|
`%||%` <- function(x, y) if (is.null(x)) y else x |
|
|
|
`%@%` <- function(x, name) attr(x, name, exact = TRUE) |
|
|
|
`%nin%` <- function(x, table) match(x, table, nomatch = 0) == 0 |
|
|
|
|
|
@ -13,6 +13,8 @@ test_that("chicklet geoms are created properly", { |
|
|
|
ggplot(debates2019) + |
|
|
|
geom_chicklet(aes(speaker, elapsed, group = timestamp, fill = topic)) -> gg |
|
|
|
|
|
|
|
print(gg) |
|
|
|
|
|
|
|
ggplot_build(gg) -> gb |
|
|
|
|
|
|
|
ggplot_gtable(gb) -> gt |
|
|
|