Skip to content

Instantly share code, notes, and snippets.

@geotheory
Created February 11, 2022 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geotheory/03eeb4d76c7440d24f4d0ffdc4960ff3 to your computer and use it in GitHub Desktop.
Save geotheory/03eeb4d76c7440d24f4d0ffdc4960ff3 to your computer and use it in GitHub Desktop.
library(ggplot2)
library(ggiraph)
data <- mtcars
data$carname <- row.names(data)
gg_point = ggplot(data = data) +
geom_point_interactive(aes(x = wt, y = qsec, color = disp,
tooltip = carname, data_id = carname)) +
theme_minimal()
g = girafe(ggobj = gg_point)
g$x$html = stringr::str_replace(g$x$html, fixed('<svg '), '<svg alt="A scatterplot of mtcars, plotting wt against qsec. The graph suggests a low correlation between two normally-distributed variables" ')
g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment