library(ggplot2)
library(scattermore)
ggplot(data.frame(x = rnorm(1e6), y = rexp(1e6))) +
geom_scattermore(aes(x, y, color = x),
pointsize = 3,
alpha = 0.1,
pixels = c(1000, 1000),
interpolate = TRUE
) +
scale_color_viridis_c()
Run the code above in your browser using DataLab