p <- ggplot (monsters2, aes (str, int, tooltip = name)) +
geom_point_interactive (aes (size = size, colour = type), alpha = 0.6 ) +
scale_color_manual (values = palette) +
scale_size_identity (guide = "legend" ,
breaks = c (1 , 3 , 4.5 , 7 , 10 ),
labels = c ("Tiny" , "Small or Medium" , "Large" , "Huge" , "Gargantuan" )) +
guides (color = guide_legend (override.aes = list (size = 4 )),
size = guide_legend (override.aes = list (color = "#EDEDED" , alpha = 1 ))) +
facet_wrap_interactive (
~ factor (alignment, levels = c (
"Lawful Good" , "Neutral Good" , "Chaotic Good" ,
"Lawful Neutral" , "Neutral" , "Chaotic Neutral" ,
"Lawful Evil" , "Neutral Evil" , "Chaotic Evil" )),
nrow = 3 , ncol = 3 , scales = "fixed" ) +
labs (title = title, colour = "Type" , size = "Size" , caption = caption,
x = "Strength" , y = "Intelligence" ) +
theme (plot.background = element_rect (fill = background),
panel.background = element_rect (fill = background),
legend.background = element_rect (fill = background),
text = element_text (family = font2, colour = "#EDEDED" , size = 16 ),
plot.title = element_text (size = 58 , family = font, face = "bold" ,
hjust = 0.5 , margin = margin (0 ,0 ,25 ,0 )),
plot.title.position = "plot" ,
plot.caption = element_text (size = 12 , hjust = 0.5 , margin = margin (40 ,0 ,0 ,0 )),
plot.caption.position = "plot" ,
axis.title = element_text (size = 36 , family = font, face = "bold" ),
legend.title = element_text (size = 32 , family = font, face = "bold" ),
legend.text = element_text (size = 18 , family = font2),
axis.text = element_text (size = 14 , color = "#EDEDED" ),
panel.grid = element_line (colour = "#454e54" , linetype = "dashed" ),
strip.background = element_rect (fill = "#444444" ),
strip.text = element_text (face = "bold" , color = "#EDEDED" , size = 16 ),
plot.margin = margin (30 ,30 ,30 ,30 ))