View source: R/interactive-ggproto.R
hover | R Documentation |
hover
componentProvides a pop up display as the mouse hovers over a plot element in the interactive plot.
hover(itemLabel = NULL, showItemLabels = NULL)
itemLabel |
A character vector of length |
showItemLabels |
A single logical value: |
a ggproto
object
active
, linking
, zoom
,
selection
, interactivity
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
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.