我用rayshader制作了这张很酷的地图,以绘制该县的工业用水量。但是我不知道如何从用鼠标移动到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页面上有很多代码和完成的结果而没有解释正在发生的事情一样。无论如何,如果有人可以帮忙,那会很酷。