Coder Social home page Coder Social logo

Display in RStudio Viewer about gganimate HOT 11 CLOSED

thomasp85 avatar thomasp85 commented on May 22, 2024 1
Display in RStudio Viewer

from gganimate.

Comments (11)

timelyportfolio avatar timelyportfolio commented on May 22, 2024

👍

from gganimate.

dgrtwo avatar dgrtwo commented on May 22, 2024

Oh excellent! I had been wondering how to present animations in RStudio but hadn't yet found browsable in htmltools!

The one thing stopping this implementation is that as per #3 there are some issues with saving plots to a non-local directory in animation. I'm working on fixing them.

A controllable in-RStudio animation widget would be really great and I'd be extremely interested in it! I'll probably be changing the output of gg_animate to be something like a "gganimate" object, which contains the relevant list of image links and whose print method would display the above browsable. So if you had a prototype htmlwidget that took a list of image files it would be easy to add it.

from gganimate.

ramnathv avatar ramnathv commented on May 22, 2024

That makes sense. I will prototype a more generic widget that will display a sequence of images as an animation. This would make it usable beyond gganimate. I will update you once I have a working prototype.

from gganimate.

ramnathv avatar ramnathv commented on May 22, 2024

Here is an initial prototype http://jsfiddle.net/ramnathv/cabkohuk/. It is a fairly straightforward one to make into a widget. I have mainly tried to replicate features from scianimator which is terrific, but heavy due to its jquery dependency. My rewrite uses mithril which is a lightweight MVC framework that clocks at 8kb gzipped and hence really lightweight.

If there are additional features you would like to see in an animation viewer, feel free to add them so I can incorporate them.

from gganimate.

timelyportfolio avatar timelyportfolio commented on May 22, 2024

Very nice, will it work with svg either directly or possibly using rsvg?

from gganimate.

timelyportfolio avatar timelyportfolio commented on May 22, 2024

also, just noticed the keybinding. Love it.

from gganimate.

timelyportfolio avatar timelyportfolio commented on May 22, 2024

@ramnathv I remembered this project https://github.com/socib/Leaflet.TimeDimension and thought it might help regarding functionality, look, and code.

from gganimate.

dgrtwo avatar dgrtwo commented on May 22, 2024

@ramnathv I've integrated the gg_animate object with a print method plan, so it's now browsable in RStudio. Please try it!

That prototype is great! Two thoughts:

  • I'd like the option to give frames titles instead of numbers: that is, instead of 0-12 on the top row, it should be possible to have 1715 UTC through 2030 UTC. The gapminder example, for instance, could have the years 1952 through 2007 in the little blue boxes. This would not work in all cases (e.g. when there are many frames or their titles are long) so it should definitely be optional, but it would especially ease browsing when the title is a factor rather than continuous.
  • There should ideally be a button to turn on looping, or at least clicking play when the animation is done should start over

I'd definitely be interested in seeing this turned into a widget and I'd get it into gg_animate right away.

from gganimate.

ramnathv avatar ramnathv commented on May 22, 2024

@dgrtwo The print method works great!

Thanks for your feedback on the animator widget. Your suggestions can be easily incorporated. I will put them on my list of stuff to implement. I will update the prototype and ping you.

from gganimate.

happyshows avatar happyshows commented on May 22, 2024

just curious about the status, is a shiny friendly version available now?

from gganimate.

mwm-cbus avatar mwm-cbus commented on May 22, 2024

First off, really cool work with this package. I wish this had been around when I was teaching statistics 😄 . A few ideas to enhance the utility of this package.

Display in RStudio

It would be nice if gganimate output could be displayed in RStudio viewer. Here is some quick and dirty code to do it.

p <- ggplot(gapminder, aes(gdpPercap, lifeExp, size = pop, color = continent, frame = year)) +
  geom_point() +
  scale_x_log10()

tf <- tempfile(fileext = '.gif')
gg_animate(p, tf, autobrowse = FALSE)
d <- htmltools::tags$img(src = base64encode::dataURI(file = "output.gif", mime="image/gif"))
htmltools::browsable(d)

Animation with Controls

This is possible with scianimator, but I find it really clunky, and the jquery requirement makes it meaty. If gganimate can return an array of image paths, it should not be hard to write a htmlwidget that would display it with controls. I can prototype something for you if this is of interest.

Love this :)
Would vote to have this rather than opening separately in default program for images, or to have the option.

from gganimate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.