Provides a pop up display as the mouse hovers over a plot element in the interactive plot.
hover(itemLabel = NULL, showItemLabels = NULL)
A character vector of length n
with a string to be used to pop up when the
mouse hovers above that element.
A single logical value: TRUE
if pop up labels are to appear on hover,
FALSE
(the default) if they are not.
a ggproto
object
if(interactive()) {
l_ggplot(mpg, mapping = aes(x = displ, y = cty)) +
geom_point(size = 4) +
# push the states of scatter plot to the histogram
hover(itemLabel =
with(mpg,
paste0("model: ", manufacturer, " ", model, "\n",
"year: ", year, "\n",
"drive way: ", drv, "\n",
"fuel type: ", fl)
),
showItemLabels = TRUE
)
# hover the mouse on top of any point to query
}