Plots are static-first: render(p) and printing produce a static SVG image. Adding interact() with + opts the plot into the interactive HTML/canvas target — render(p) then produces the interactive page instead (an explicit render(p, target = ) always wins).

Interact(tooltip = NULL, zoom = logical(0), brush = logical(0))

interact(tooltip = TRUE, zoom = TRUE, brush = TRUE)

Arguments

tooltip

TRUE (default) shows the mapped x/y values on hover; FALSE disables the tooltip; a character vector of column names (e.g. tooltip = c("model", "hwy")) shows those columns from the layer data instead.

zoom

Enable scroll-to-zoom and double-click-to-reset.

brush

Enable brush-to-zoom: drag a rectangle on the plot to zoom to it (double-click still resets).

Value

An Interact spec to add to a plot with +.

Examples

p <- ggnext(cars, aes(speed, dist)) + geom_point()
render(p)                 # static SVG
#> <ggnext static render: 7,304 characters>
#> Use render(p, file = ...) to save it, or cat(x) to see the source.
pi <- p + interact()      # same plot, interactive by default
html <- render(pi)        # HTML/canvas with tooltip + zoom + brush