I'd like ultimately to insert R (interactive or not) graphics in the tooltips of a ggiraph. Using an iframe as I successfully did before with leaflet, it would look like this:
library(ggplot2)
library(ggiraph)
library(htmltools)
p <- {ggplot() +
aes(1,1, tooltip = "blabla") +
geom_point_interactive()} %>%
girafe(ggobj = .)
save_html(p, file = "test.html") # I would use a loop to save many different graphs at the same time
{ggplot() +
aes(1,1, tooltip = HTML("<iframe src='test.html' frameborder=0 width=300 height=300></iframe>")) +
geom_point_interactive()} %>%
girafe(ggobj = .)
Unfortunately, I came with somewhat of a bug. Let's try:
{ggplot() +
aes(1,1, tooltip = HTML("<iframe src='https://stackoverflow.com' frameborder=0 width=300 height=300></iframe>")) +
geom_point_interactive()} %>%
girafe(ggobj = .)
In Firefox, it gives just a black square and in RStudio IDE it unexpectedly opens the site in a browser on mouse hover. black square tooltip
So I've got 2 questions:
- Why iframes are not working inside a ggiraph tooltip?
- Do you have any idea (it can be something else than iframes, of course, and hopefully more elegant) to insert R (interactive or not) graphics in the tooltips of a ggiraph (without shiny)?