美文网首页
Flat Rotation(ggplot)

Flat Rotation(ggplot)

作者: 倪桦 | 来源:发表于2022-12-27 19:07 被阅读0次

1. Prepare Flat

suppressMessages({library(ggplot2);library(ggstar);library(cowplot);library(dplyr)})
p<- data.frame(x=.5,y=.5) %>% 
    ggplot(aes(x=x,y=y)) +
    geom_star(starshape=15,size=80,starstroke=2,color = "firebrick",fill = NA)+
    geom_star(starshape=22,size=50,starstroke=0,fill = "firebrick")+
    geom_star(starshape=15,size=20,starstroke=0,fill = "gold")+
    theme_minimal() + coord_equal(xlim = c(0,1),ylim = c(0,1))+
    theme(panel.grid = element_blank(),axis.text = element_blank(),axis.title = element_blank(),legend.position = "none") +
    ggnewscale::new_scale_fill() +
    geom_star(data = expand.grid(x=seq(.25,.75,.5),y=seq(.25,.75,.5)),aes(x = x,y=y),starshape=2,size=10,starstroke=0,fill = "gold")

2. Rotating Whole Plot

animation:::saveGIF(movie.name= "Plots.gif",{
    for (fp in seq(0,360,10)) { ggdraw() + draw_plot(ggplotify::as.ggplot(p,angle = fp)) + draw_label(x = .5 ,y=.5,label = "淦",color = "grey50",size = 22)->tmp;print(tmp)}
}, interval = .1, ani.width = 800, ani.height = 800)

3. Results Display

Plots.gif

相关文章

网友评论

      本文标题:Flat Rotation(ggplot)

      本文链接:https://www.haomeiwen.com/subject/wjqaqdtx.html