Dear team,
I love that it is possible to create vector graphics with ggplot2.
But plotting scatter plots or other plots with many elements will lead to files with MANY objects, which I would love to avoid.
I could export them into png, but would lose the vectors or I could merge points using e.g. geom_hex.
But I would love to include only visible points into the final vector graphics and remove all hidden elements. Is there a way to do this?
Thank you very much!
Best
Felix
minimal example:
plot_data <- data.frame(x = runif(100000),
y = runif(100000))
p <- plot_data %>%
ggplot2::ggplot(aes(x = x,
y = y,
fill = y)) +
ggplot2::geom_point(shape = 21,
color = "black",
stroke = 0.2)
ggplot2::ggsave(file="test.svg", plot=p, width=10, height=8)