I have a data frame with 1e7 observations for points with an x and y coordinate. Obviously this would be a bit much to visualize with geom_point
, so I'm trying to use geom_density_2d
. But this runs into an error:
Warning messages:
1: Computation failed in `stat_density2d()`:
cannot allocate vector of size 2.6 Gb
2: Computation failed in `stat_density2d()`:
cannot allocate vector of size 2.6 Gb
What are my options? I can group overlapping points and count them, resulting in a data frame on the order of 1e5 observations, but then I lose a lot of the information for density (I have not been able to find a way to make it recognize the counts for each overlapping point).
How can I use geom_density2d
on a data frame of this size?
EDIT: I am trying to avoid the hex and bin_2d geometries.