Reputation: 11
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()))
Upvotes: 1
Views: 678
Reputation: 783
I had the same issue and learned that the package requires ggplot2
version 3.5.0 or higher. Updating ggplot2 to the latest version worked for me.
Upvotes: 0
Reputation: 59
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.
Upvotes: 0