ソースを参照

loads but there will be issues with enter/exit in anim_opts

pkg-fix
コミット
e775ebccd0
6個のファイルの変更27行の追加16行の削除
  1. +2
    -3
      DESCRIPTION
  2. +8
    -0
      NAMESPACE
  3. +5
    -3
      R/animate_options.R
  4. +7
    -7
      R/plot_helpers.R
  5. +1
    -1
      R/process_data_helpers.R
  6. +4
    -2
      R/zzzz-package.R

+ 2
- 3
DESCRIPTION ファイルの表示

@@ -18,11 +18,10 @@ Authors@R:
Description: Animated explanations of the verbs in the tidyverse
using gganimate and ggplot2.
License: MIT + file LICENSE
Depends:
gganimate (>= 0.9.9.9999),
ggplot2 (>= 3.0.0)
Imports:
dplyr,
gganimate (>= 1.0.0),
ggplot2 (>= 3.0.0),
magrittr,
purrr,
rlang (>= 0.1.2),

+ 8
- 0
NAMESPACE ファイルの表示

@@ -36,6 +36,14 @@ importFrom(dplyr,row_number)
importFrom(dplyr,select)
importFrom(dplyr,semi_join)
importFrom(dplyr,slice)
importFrom(gganimate,enter_fade)
importFrom(gganimate,exit_fade)
importFrom(gganimate,transition_states)
importFrom(ggplot2,aes)
importFrom(ggplot2,element_text)
importFrom(ggplot2,ggplot)
importFrom(ggplot2,labs)
importFrom(ggplot2,theme)
importFrom(magrittr,"%>%")
importFrom(tidyr,gather)
importFrom(tidyr,spread)

+ 5
- 3
R/animate_options.R ファイルの表示

@@ -146,7 +146,7 @@ validate_anim_opts <- function(ao, quiet = FALSE, strict = getOption("tidyexplai
rlang::warn("Use `anim_options()` to set `anim_opts`")
}
ao <- fill_anim_opts(ao)
stopifnot(is.ggproto(ao$enter[[1]]), is.ggproto(ao$exit[[1]]))
stopifnot(ggplot2::is.ggproto(ao$enter[[1]]), ggplot2::is.ggproto(ao$exit[[1]]))
extra_names <- setdiff(names(ao), names(formals(anim_options)))
if (!quiet && length(extra_names)) {
extra_names <- paste0(sprintf("`%s`", extra_names), collapse = ", ")
@@ -175,10 +175,12 @@ default_anim_opts <- function(family, ao_custom = NULL) {
family <- match.arg(family, family_options, several.ok = FALSE)
ao_default <- switch(
family,
"gather" = anim_options(enter = enter_fade(), exit = exit_fade(),
"gather" = anim_options(enter = gganimate::enter_fade(),
exit = gganimate::exit_fade(),
ease_default = "sine-in-out",
ease_other = list(y = "cubic-out", x = "cubic-in")),
"spread" = anim_options(enter = enter_fade(), exit = exit_fade(),
"spread" = anim_options(enter = gganimate::enter_fade(),
exit = gganimate::exit_fade(),
ease_default = "sine-in-out",
ease_other = list(y = "cubic-out", x = "cubic-in")),
anim_options()

+ 7
- 7
R/plot_helpers.R ファイルの表示

@@ -63,14 +63,14 @@ static_plot <- function(

ggplot(d, aes(x = .x * width, y = .y * height, fill = .color, alpha = .alpha,
group = .item_id)) +
geom_tile(width = 0.9 * width, height = 0.9 * height) +
coord_equal() +
geom_text(data = d %>% filter(!is.na(.val)), aes(label = .val, color = .textcolor),
ggplot2::geom_tile(width = 0.9 * width, height = 0.9 * height) +
ggplot2::coord_equal() +
ggplot2::geom_text(data = d %>% filter(!is.na(.val)), aes(label = .val, color = .textcolor),
family = ao$text_family, size = text_size) +
scale_fill_identity() +
scale_color_identity() +
scale_alpha_identity() +
ggplot2::scale_fill_identity() +
ggplot2::scale_color_identity() +
ggplot2::scale_alpha_identity() +
labs(title = title) +
theme_void() +
ggplot2::theme_void() +
theme(plot.title = element_text(family = ao$title_family, hjust = 0.5, size = title_size))
}

+ 1
- 1
R/process_data_helpers.R ファイルの表示

@@ -21,7 +21,7 @@ process_join <- function(x, y, by, fill = TRUE, ...,
add_duplicate_number <- function(a) {
data_frame(v = a) %>%
group_by(v) %>%
mutate(id = paste(v, 1:n(), sep = "-")) %>%
mutate(id = paste(v, 1:dplyr::n(), sep = "-")) %>%
pull(id)
}


+ 4
- 2
R/zzzz-package.R ファイルの表示

@@ -1,6 +1,8 @@
#' @importFrom dplyr left_join right_join full_join inner_join semi_join anti_join
#' @importFrom dplyr mutate select filter arrange bind_rows bind_cols group_by pull slice data_frame row_number
#' @importFrom tidyr gather spread
#' @importFrom ggplot2 ggplot aes element_text theme labs
#' @importFrom gganimate enter_fade exit_fade transition_states
#' @keywords internal
"_PACKAGE"

@@ -10,8 +12,8 @@ plot_settings$default <- list(
state_length = 1,
ease_default = "sine-in-out",
ease_other = NULL,
enter = setNames(list(enter_fade()), "enter_fade()"),
exit = setNames(list(exit_fade()), "exit_fade()"),
enter = setNames(list(gganimate::enter_fade), "enter_fade()"),
exit = setNames(list(gganimate::exit_fade), "exit_fade()"),
text_family = "Fira Mono",
title_family = "Fira Mono",
text_size = 5,

読み込み中…
キャンセル
保存