Experiment
usmapdata::us_map() |>
ggplot() +
aes(fill = as.numeric(fips),
tooltip = full ) +
geom_sf_interactive()

girafe(ggobj = last_plot())
usmapdata::us_map() |>
ggplot() +
aes(fill = as.numeric(fips),
tooltip = full ) +
geom_sf_interactive()

girafe(ggobj = last_plot())
usa_ref <- usmapdata::us_map() |>
select(state_name = full,
state_abb = abbr,
geometry = geom,
everything())
geom_state <- ggregions::write_geom_region_locale(usa_ref)
geom_state
## function (mapping = aes(), data = NULL, stat = StatRegion, position = "identity",
## na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ref_data = usa_ref,
## ...)
## {
## c(layer_sf(geom = GeomSf, data = data, mapping = mapping,
## stat = stat, position = position, show.legend = show.legend,
## inherit.aes = inherit.aes, params = rlang::list2(na.rm = na.rm,
## ref_data = ref_data, ...)), coord_sf(crs = st_crs_mod(ref_data)))
## }
## <environment: namespace:ggregions>
state.name |>
data.frame(state = _) |>
mutate(ind_vowel = str_detect(state, "^[AEIOU]")) |>
ggplot() +
aes(state_name = state,
fill = ind_vowel,
tooltip = state ) +
ggiraph::geom_sf_interactive(stat = ggregions:::StatRegion,
ref_data = usa_ref)
## Joining with `by = join_by(state_name)`

geom_state_interactive <- function(...){
list(ggiraph::geom_sf_interactive(stat = ggregions:::StatRegion,
ref_data = usa_ref),
coord_sf(crs = ggregions:::st_crs_mod(usa_ref)))
}
state.name |>
data.frame(state = _) |>
mutate(ind_vowel = str_detect(state, "^[AEIOU]")) |>
ggplot() +
aes(state_name = state,
fill = ind_vowel,
tooltip = state ) +
geom_state_interactive()
## Joining with `by = join_by(state_name)`

girafe(ggobj = last_plot())
## Joining with `by = join_by(state_name)`