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

Replacing the demo video #13

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Replacing the demo video #13

wants to merge 9 commits into from

Conversation

kocabiyik
Copy link

@nzgwynn
Copy link

nzgwynn commented Apr 6, 2021

This might be of interest for an example. It animates and sonifies a loess curve for accessibility.

`

This is coding that sonifies and animates a loess

curve

library(lattice)
library(ggplot2)
library(sonify)
library(gganimate)
library(broom)
library(tidyverse)
library(av)

l2 <- loess(NOx ~ E, ethanol)
fit <- augment(l2)
s <- sonify(l2$x, l2$fitted, duration = 4, play = TRUE)
writeWave(s, filename = "audio")

df <- tibble(fit$E, fit$NOx)
names(df) <- c("x", "y")

p <- fit %>%
arrange(.fitted) %>%
ggplot(aes(E, NOx)) +
geom_line(aes(y = .fitted), color = "red") +
transition_reveal(E, keep_last = TRUE) +
geom_point(data = df, aes(x, y))

anim_p <- animate(p, renderer = av_renderer(), duration = 10)

anim_save(filename = "annimation.mp4", animation = anim_p)

av::av_encode_video(input = "annimation.mp4", output = "both.mp4", audio = "audio")`

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

Successfully merging this pull request may close these issues.

2 participants