df <- data.frame(wt = mtcars$wt, mpg = mtcars$mpg, model = rownames(mtcars))
vplot(df) |>
mark_point(x = wt, y = mpg, tooltip = model, data_id = model) |>
as_widget()Interactive widget
Interactive
Any vellumplot becomes a client-side interactive widget with as_widget(): hover, select, brush, and zoom.
Pipe any vellumplot into as_widget() and it becomes a self-contained HTML widget: hover a point for a tooltip, click to select, drag a rectangle to brush, scroll to zoom. It runs entirely in the browser, with no server.
Declare tooltip and data_id on the mark to give each point a label and a stable key for interactions.
Colour maps to a discrete variable get an interactive legend for free: hover a swatch to highlight its series, click to select it.
df$cyl <- factor(mtcars$cyl)
vplot(df) |>
mark_point(x = wt, y = mpg, color = cyl, tooltip = model, data_id = model) |>
as_widget()