Error when running code examples from usmap r package

43 Views Asked by At

I have updated my R to the newest version. Cleared my R environment. I am trying to run this simple code using the usmap package, but keep getting this error.

plot_usmap(data = statepop, values = "pop_2022")
Error in `mapply()`:
! The `legend.justification.inside` theme element is not defined in the
  element hierarchy.
Backtrace:
 1. base (local) `<fn>`(x)
 2. ggplot2:::print.ggplot(x)
 4. ggplot2:::ggplot_gtable.ggplot_built(data)
 5. ggplot2:::plot_theme(plot)
 6. base::mapply(validate_element, theme, names(theme), MoreArgs = list(element_tree = get_element_tree()))
1

There are 1 best solutions below

0
Derek White On

I've been getting the same error using usmap but with a different dataset. Are you also using Google Colab? I also had a hard time just getting the package installed for Colab, so I'm wondering if that's the source of the problem.