Skip to content

view_follow does not work with geom_col #304

@aljabadi

Description

@aljabadi

I am trying to create a gganimate plot using geom_col and I wanted the y axis not te be fixed. When I use view_follow I get an error:

library(gganimate)

# Create example data
df <- data.frame(year = factor(sort(rep(2001:2005, 3))),
                 income = round(runif(15, 70, 110)),
                 staff = rep(c("Sam","Joe", "Rob"), 5))
## plot
ggp2 <- ggplot(df, aes(x = staff, y = income)) +
  geom_col( aes(fill = staff), show.legend = FALSE) + transition_states(year, transition_length = 1, state_length = 0) +
  labs(x=NULL)
## run with fixed axes
animate(ggp2, nframes=10)
# Frame 10 (100%)
# Finalizing encoding... done!

try view_follow:

animate(ggp2+view_follow(fixed_x = TRUE), nframes=10)

# Error in png::readPNG(frames[1], native = TRUE) : 
#   unable to open /var/folders/bs/0t9zm3653_xfh1h1_jxq9x740000gn/T//RtmpWs6Cnx/1ee818608d3a/gganim_plot0001.png
# In addition: There were 11 warnings (use warnings() to see them)

Warnings are:

warnings()
Warning messages:
1: Cannot get dimensions of plot table. Plot region might not be fixed
2: attempt to apply non-function

SessionInfo()

R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS 10.14.2

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] gganimate_1.0.2.9000 reshape_0.8.8 ggforce_0.2.0.9000 ggplot2_3.1.0.9000 magrittr_1.5

loaded via a namespace (and not attached):
[1] Rcpp_1.0.0 pillar_1.3.1 compiler_3.5.0 plyr_1.8.4 prettyunits_1.0.2 progress_1.2.0 tools_3.5.0
[8] digest_0.6.18 tibble_2.0.1 gtable_0.2.0 png_0.1-7 pkgconfig_2.0.2 rlang_0.3.1 cli_1.0.1
[15] rstudioapi_0.9.0 yaml_2.2.0 xfun_0.5 withr_2.1.2 dplyr_0.8.0.1 stringr_1.4.0 knitr_1.21
[22] hms_0.4.2 grid_3.5.0 tidyselect_0.2.5 glue_1.3.0 R6_2.4.0 gifski_0.8.6 fansi_0.4.0
[29] polyclip_1.9-1 purrr_0.3.1 tweenr_1.0.1 farver_1.1.0 reshape2_1.4.3 scales_1.0.0 MASS_7.3-51.1
[36] assertthat_0.2.0 colorspace_1.4-0 labeling_0.3 utf8_1.1.4 stringi_1.3.1 lazyeval_0.2.1 munsell_0.5.0
[43] crayon_1.3.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions