Rsgf: Example Heatmap and plot3D Animations for Edo Period Data

https://bcable.net/x/Rsgf

library(Rsgf)
library(ggplot2)
library(grid)
library(pander)
library(plot3D)
library(png)
library(rmarkdown)

https://bcable.net/x/Rproj/shared

source("shared/Rsgf_board_funcs.R")

Using GoGoDSpring2018 database

sgf_path <- path.expand("~/SGF/Database/GoGoDSpring2018")
source("shared/Rsgf_GoGoD_file_paths.R")
MAX_FUN <- 300

FUNgen_movecum <- function(i){
    eval(str2expression(paste0(
        "function(moves){ moves[moves$Move.Number <= ", i, ",] }",
        sep=""
    )))
}

FUNgen_moveequal <- function(i){
    eval(str2expression(paste0(
        "function(moves){ moves[moves$Move.Number == ", i, ",] }",
        sep=""
    )))
}

movecum_FUNs <- lapply(1:MAX_FUN, FUNgen_movecum)
moveequal_FUNs <- lapply(1:MAX_FUN, FUNgen_moveequal)

Edo Period Games Heatmap and plot3D Animations

length(file_names_edo)
## [1] 3866
ret_movecum <- loop_data_graphs(file_names_edo, movecum_FUNs)
ret_moveequal <- loop_data_graphs(file_names_edo, moveequal_FUNs)

Frame Generation

Heatmap Frames

for(i in 1:length(ret_movecum)){
    g <- period_graph(
        ret_movecum[[i]],
        sprintf("frames/plot_heatmap_edo_movecum_%03d.png", i)
    )
}
for(i in 1:length(ret_moveequal)){
    g <- period_graph(
        ret_moveequal[[i]],
        sprintf("frames/plot_heatmap_edo_moveequal_%03d.png", i)
    )
}

plot3D Frames

for(i in 1:length(ret_movecum)){
    board_plot3d(
        ret_movecum[[i]],
        sprintf("frames/plot_plot3d_edo_movecum_%03d.png", i)
    )
}
for(i in 1:length(ret_moveequal)){
    board_plot3d(
        ret_moveequal[[i]],
        sprintf("frames/plot_plot3d_edo_moveequal_%03d.png", i)
    )
}

Animations

Heatmap Cumulative Moves

anim_heatmap_edo_movecum.mp4

Heatmap Individual Moves

anim_heatmap_edo_moveequal.mp4

plot3D Cumulative Moves

anim_plot3d_edo_movecum.mp4

plot3D Individual Moves

anim_plot3d_edo_moveequal.mp4