Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frame Sticks across Animation #36

Closed
mhbw opened this issue Feb 13, 2017 · 2 comments
Closed

Frame Sticks across Animation #36

mhbw opened this issue Feb 13, 2017 · 2 comments

Comments

@mhbw
Copy link

mhbw commented Feb 13, 2017

mostly detailed here, I've attached the base file for reproduction.
newnolarank4.txt

it seems one frame will get stuck as a shadow across all the animation.

I've got a data frame that looks like the below:

head(newnolarank)

lon      lat week b
1 -90.06445 29.97121    1 9
2 -90.06704 29.96944    1 9
3 -90.07495 29.96567    1 9
4 -90.07448 29.96621    1 9
5 -90.16480 29.91240    1 9
6 -90.04797 29.94557    1 9

my map was generated from the get_map function in ggmap

map <- get_map("New Orleans, LA", zoom=10, color="bw")

I used geom_hex to make a hex map

   p <- ggmap(map)+
    coord_cartesian()+
    stat_binhex(data=newnolarank,aes(x=lon, y=lat, alpha=0.5, frame = as.factor(b), cumulative = FALSE))+
    scale_fill_continuous(low="#ACD9F4",high="#EC008C")+
    theme(text=element_text(family="Avenir"), 
    axis.line=element_blank(), 
    axis.ticks = element_blank(), 
    axis.text = element_blank(), 
    plot.title=element_text(hjust=0.5),
     axis.title=element_blank())

Then used gganimate to make a gif. Here in is the problem; the resulting gif seems to have the old images even though cumulative was set to false, which creates an undesired effect of overlaying hexs, or hexes showing up in odd areas.

gganimate(p, "gif1.gif", title_frame = TRUE)

you can also see the overlay in the legends.

@mhbw
Copy link
Author

mhbw commented Feb 14, 2017

update:

it looks like part of the problem was NAs in the frame column, b, which caused the first shadow but doesn't explain the "jittered" legend. additionally I tried setting cumulative to TRUE which failed. I've tried that in versions ref="fd6967f" and ref="26ec501" which also failed for cumulative, although the jittered legend stopped.

@dgrtwo
Copy link
Collaborator

dgrtwo commented Jul 5, 2018

We are finishing a complete rewrite of gganimate undertaken by Thomas Pedersen, with massive breaking changes to the API (this will come with a version bump to 1.0.0; currently 0.9.9.9999). This fixes many existing bugs and installation difficulties, and offers a more intuitive grammar of graphics.

As a result I'm closing almost all open issues, since they aren't relevant to the new version (bug reports in particular no longer apply). I apologize for any inconvenience in updating your existing code, but the new version of gganimate will be well worth the effort.

  • If you are still interested in this issue and believe it is relevant to the new version of gganimate, you can reopen it!

  • If you'd like to continue using the old gganimate version (which we do not recommend, as it will not be maintained), you can install from this release using the following code:

    devtools::install_github("dgrtwo/gganimate", ref = "v0.1.1”)
    

@dgrtwo dgrtwo closed this as completed Jul 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants