2

我用光线着色器制作了这张很酷的地图,以绘制该县的工业用水量。但我不知道如何从用鼠标移动的情节转到 Gif。这是非 Gif Rayshader 绘图的代码:

library(tidyverse)
library(devtools)
devtools::install_github("tylermorganwall/rayshader")
library(rayshader)
library(usmap)


water <- read.csv("water.csv", header = TRUE, 
                  check.names = FALSE, 
                  stringsAsFactors=FALSE)

#usmaps needs a fips value
water <- water %>% 
  rename(fips = FIPS)

#"IN-Wtotl" is just total industrial water use
water <- water %>% 
  select("COUNTY","fips","IN-Wtotl")

#Get the 2D map
plotmap <- 
  plot_usmap(data = water,
             values = "IN-Wtotl",
             lines = FALSE,
             labels = FALSE) +
  scale_fill_continuous(high = "#D62828",
                        low = "#252158",
                        na.value= "lightgray",
                        name = "Industrial water use (Mgal/d)",
                        label = scales::comma)+
  theme(legend.position = "right") +
  theme(text = element_text(family="Arial", face="bold"))

#Get the sweet rayshader action
plot_gg(plotmap,multicore = TRUE, width = 7, height = 4, fov = 100, scale = 300, zoom = .25)

我不知道从这里到 gif 阶段要从哪里开始。有人有建议吗?这方面的文档不是很好,就像三个 github 页面有很多代码和完成的结果,没有解释发生了什么。无论如何,如果有人可以帮忙,那就太酷了。

4

0 回答 0