static_plot_tooltip_fancy <- ggplot(
data = partisan_names,
mapping = aes(
x = part_diff,
y = fct_rev(year),
color = outcome
)
) +
geom_point_interactive(
position = position_quasirandom(),
mapping = aes(
tooltip = fancy_label,
data_id = name_safe
)
) +
scale_x_continuous(labels = label_percent(style_positive = "plus")) +
scale_color_manual(values = c(dem, rep), guide = "none") +
labs(
title = "The most popular names have gotten more polarized",
x = "Partisan gap",
y = NULL,
) +
theme(legend.position = "none")
girafe(
ggobj = static_plot_tooltip_fancy,
options = list(
opts_tooltip(css = "background-color: #ffffff; color: #111111; padding: 6px; border: 1px solid #999;")
)
)