2

I made this cool map with rayshader to plot the amount of industrial water use by the county. But I don't know how to go from plot you move with the mouse to a Gif. Here's the code for the non-Gif Rayshader plot:

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)

I have no idea where to go from here in terms of getting it to the gif stage. Anyone have suggestions? The documentation on this isn't great, just like three github pages with a lot of code and finished results without explaining what's happening. Anyway if someone can help out that'd be cool.

zx8754
  • 52,746
  • 12
  • 114
  • 209
matt_lnrd
  • 329
  • 1
  • 9
  • From looking at the github page, it seems like the `render_movie` function should help with this. It creates an mp4 file but there should be lots of tools available to convert that to gif or something similar (a lot of "gifs" on the web aren't actually .gif format these days, .gif is very heavy and is slowly being replaced) – Marius Jul 11 '19 at 02:30

0 Answers0