Created
March 25, 2024 12:25
-
-
Save abikoushi/9b9636fc603b8007eb230777318bdf09 to your computer and use it in GitHub Desktop.
Lissajous Curve
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(gganimate) | |
library(dplyr) | |
th <- seq(-pi,pi,by=0.01) | |
a <- seq(1,6, by=0.1) | |
df <- data.frame(x=c(cos(outer(th,a))), | |
y=rep(sin(th), length(a)), | |
a=rep(a, each=length(th))) | |
ggplot(df, aes(x=x, y=y, group=a, colour=a))+ | |
geom_path()+ | |
facet_wrap(~a)+ | |
scale_color_continuous(type = "viridis")+ | |
theme_classic()+ coord_fixed() | |
#### | |
#bob | |
th <- seq(-pi,pi,by=0.001) | |
a <- 3 | |
df <- data.frame(x=cos(a*th), | |
y=sin(th), | |
th=th) | |
ggplot(df, aes(x=x, y=y, group=1))+ | |
geom_path(linewidth=2)+ | |
theme_classic(18)+ coord_fixed()+ | |
transition_reveal(th) | |
anim_save("bob.gif") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment