Why is plot_usmap not displaying properly on secure server?

36 Views Asked by At

I wrote a script to show the number of events in a given county. On my local machine, it displays properly and looks great! But when I run the exact same code on the exact same dataset on a secure server (where I have to be able to run the script in order to incorporate data that has higher security requirements) it looks different, and wrong. The legend doesn't show and the color fill in the counties is missing, too.

library(tidyverse)
library(foreign)
library(haven)
library(data.table)
library(devtools)
library(usmap)

joined_v_cross <- read_dta("path/to/my/data/here.dta")

toy_example <- 
  plot_usmap(data = joined_v_cross, values = "toy_values", include = c("AL", "AR", "FL", "GA", "LA", "NC", "SC", "KY", "TN", "MS"), color = "blue") + 
  scale_fill_continuous(low = "white", high = "blue", name = " events count", label = scales::comma) + 
  labs(title = "Example Map", subtitle = "1810 - 1900") +
  theme(legend.position = "right")

toy_example

Map from my local machine:

enter image description here

Map from secure server:

enter image description here

I updated the versions of R, Rstudio, and all of the packages and the maps still look incorrect on the secure server. Any ideas what's going on here? Thank you thank you!

1

There are 1 best solutions below

0
Elizabeth Breen On

The answer is, my data wasn't compiling properly on the server and the map output is the result of a column full of NAs. You live, you learn.