Skip to content

Commit 36b52ad

Browse files
committed
more stuff to make R CMD check happy
1 parent a29f44f commit 36b52ad

File tree

3 files changed

+25
-53
lines changed

3 files changed

+25
-53
lines changed

R/animate.R

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
#' @rdname animation
2929
#' @author Carson Sievert
3030
#' @examples
31-
#'
32-
#' # for more, see https://cpsievert.github.io/plotly_book/key-frame-animations.html
3331
#'
3432
#' df <- data.frame(
3533
#' x = c(1, 2, 2, 1, 1, 2),
@@ -46,31 +44,19 @@
4644
#' animation_opts(transition = 0)
4745
#'
4846
#' # works the same way with ggplotly
49-
#' p <- ggplot(txhousing, aes(month, median)) +
50-
#' geom_line(aes(group = year), alpha = 0.3) +
51-
#' geom_smooth() +
52-
#' geom_line(aes(frame = year, ids = month), color = "red") +
53-
#' facet_wrap(~ city)
54-
#'
55-
#' ggplotly(p, width = 1200, height = 900) %>%
56-
#' animation_opts(1000)
57-
#'
58-
#' if (system.file(package = "gapminder") != "") {
59-
#'
60-
#' # use the ids attribute to ensure object constancy
61-
#' p <- ggplot(gapminder, aes(gdpPercap, lifeExp, size = pop,
62-
#' color = continent, frame = year, ids = country)) +
63-
#' geom_point() +
64-
#' scale_x_log10()
65-
#' ggplotly(p)
66-
#'
67-
#' p2 <- ggplot(gapminder, aes(gdpPercap, lifeExp)) +
68-
#' geom_point(aes(size = pop), alpha = 0.5) +
69-
#' # animations can be specified on the layer level
70-
#' geom_point(aes(size = pop, frame = year, ids = country), color = "red") +
71-
#' scale_x_log10()
72-
#' ggplotly(p2)
47+
#' if (interactive()) {
48+
#' p <- ggplot(txhousing, aes(month, median)) +
49+
#' geom_line(aes(group = year), alpha = 0.3) +
50+
#' geom_smooth() +
51+
#' geom_line(aes(frame = year, ids = month), color = "red") +
52+
#' facet_wrap(~ city)
53+
#'
54+
#' ggplotly(p, width = 1200, height = 900) %>%
55+
#' animation_opts(1000)
7356
#' }
57+
#'
58+
#'
59+
#' #' # for more, see https://cpsievert.github.io/plotly_book/key-frame-animations.html
7460
#'
7561
animation_opts <- function(p, frame = 500, transition = frame, easing = "linear",
7662
redraw = FALSE, mode = "immediate") {

R/plotly.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ plot_dendro <- function(d, set = "A", xmin = -50, height = 500, width = 500, ...
316316
data = tidy_segments, xend = ~yend, yend = ~xend, showlegend = FALSE
317317
) %>%
318318
add_markers(
319-
data = filter(allXY, y > 0), key = ~label, set = set, name = "nodes",
319+
data = allXY[allXY$y > 0, ], key = ~label, set = set, name = "nodes",
320320
text = ~paste0("members: ", members), hoverinfo = "text"
321321
) %>%
322322
add_text(

man/animation.Rd

Lines changed: 12 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)