The ggiraph
package extends ggplot2
to add interactivity. One feature is the ability to zoom in on a plot, for example using the following code:
library(ggplot2)
library(ggiraph)
data(mtcars)
mtcars$model <- rownames(mtcars)
gg <- ggplot(mtcars, aes(x = mpg, y = disp)) +
geom_point_interactive(aes(color = as.factor(cyl),
tooltip = model))
girafe(ggobj = gg) %>%
girafe_options(opts_zoom(max = 5),
opts_tooltip(use_fill = TRUE))
When previewing the chart is is possible to zoom in by clicking the magnifying glass and scrolling. As the user zooms, the points enlarge, but the tooltip stays the same size.
Is it possible to adjust the geom sizes (e.g., point radius or line thickness) when zooming in?
There are probably lots of reasons this would be useful, but I'm specifically thinking about overplotting - I have a dense dataset but zooming in doesn't help because the points still cover one another.
I'm using ggiraph
because it is a simple extension to ggplot2
but if there is a comparable package I would be open to other solutions.