From 920a01dc2bbd22fa284851603f98a4b11b17570f Mon Sep 17 00:00:00 2001 From: MFaroukB <49352669+MFaroukB@users.noreply.github.com> Date: Mon, 8 Apr 2019 15:48:22 -0500 Subject: [PATCH 1/3] Update save.R --- R/save.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/R/save.R b/R/save.R index 308e148..c00b775 100644 --- a/R/save.R +++ b/R/save.R @@ -32,6 +32,10 @@ saveviz <- function(x, ...) { #' @importFrom RColorBrewer brewer.pal #' @rdname plot_carp #' @export + +frame_rate <- 10 +frames_number <- 100 + saveviz.CARP <- function(x, file.name, type = c("dendrogram", "path", "js"), @@ -101,7 +105,7 @@ saveviz.CARP <- function(x, percent.seq = percent.seq) animation::ani.options(ani.width = convert_units(width, from = units, to = "px"), ani.height = convert_units(height, from = units, to = "px")) - gganimate::anim_save(filename = file.name, animation = animate(p)) + gganimate::anim_save(filename = file.name, animation = animate(p, nframes = frames_number, fps = frame_rate)) invisible(file.name) }, dendrogram = { From c287761452bd81358f69abcf9a64799e96a03bb1 Mon Sep 17 00:00:00 2001 From: MFaroukB <49352669+MFaroukB@users.noreply.github.com> Date: Mon, 8 Apr 2019 18:18:47 -0500 Subject: [PATCH 2/3] Update save.R --- R/save.R | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/R/save.R b/R/save.R index c00b775..16c7a2a 100644 --- a/R/save.R +++ b/R/save.R @@ -1,6 +1,6 @@ #' @rdname plot_carp #' @export -saveviz <- function(x, ...) { +saveviz <- function(x,frames_number,frame_rate, ...) { UseMethod("saveviz", x) } @@ -32,10 +32,6 @@ saveviz <- function(x, ...) { #' @importFrom RColorBrewer brewer.pal #' @rdname plot_carp #' @export - -frame_rate <- 10 -frames_number <- 100 - saveviz.CARP <- function(x, file.name, type = c("dendrogram", "path", "js"), From 69d363f30d388a7aaf391fce3a302c091e8c55f2 Mon Sep 17 00:00:00 2001 From: MFaroukB <49352669+MFaroukB@users.noreply.github.com> Date: Mon, 8 Apr 2019 21:45:13 -0500 Subject: [PATCH 3/3] Update save.R --- R/save.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/R/save.R b/R/save.R index 16c7a2a..1d270f4 100644 --- a/R/save.R +++ b/R/save.R @@ -1,6 +1,6 @@ #' @rdname plot_carp #' @export -saveviz <- function(x,frames_number,frame_rate, ...) { +saveviz <- function(x, ...) { UseMethod("saveviz", x) } @@ -20,6 +20,8 @@ saveviz <- function(x,frames_number,frame_rate, ...) { #' @param width The width of the output, given in \code{unit}s #' @param height The height of the output, given in \code{unit}s #' @param units The unit in which \code{width} and \code{height} are specified +#' @param frames_number the total number of frames passed to nframes in animate() +#' @param frame_rate the frames per second passed to parameter fps in animate() #' @importFrom stats as.dendrogram #' @importFrom ggplot2 ggplot aes geom_path geom_point geom_text guides theme element_text #' @importFrom ggplot2 xlab ylab scale_color_manual ggsave @@ -45,6 +47,8 @@ saveviz.CARP <- function(x, width = 8, height = 5, units = c("in", "cm", "mm", "px"), + frames_number = 100, + frame_rate = 24, ...) { type <- match.arg(type)