79146430

Date: 2024-10-31 21:52:05
Score: 1
Natty:
Report link

When you add geom_text, it inherits all of the aesthetics you specified inside ggplot - but because you are using different data for geom_text, it can't find .estimate. You can just move aes(fill = .estimate) from inside ggplot to inside geom_sf.

drought_sf %>%
  left_join(drought_rmse, by = 'GEOID') %>%
  ggplot() +
  geom_sf(color = NA, alpha = 0.8, aes(fill = .estimate)) +
  labs(fill = "RMSE") +
  scale_fill_viridis_c(labels = scales::dollar_format()) +
  geom_text(
    data = cities_data, 
    aes(x = long, y = lat, label = fixed_name), 
    color = 'black', 
    check_overlap = TRUE
  )

enter image description here

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Starts with a question (0.5): When you add
  • Low reputation (0.5):
Posted by: Eonema