我正在寻找由ggplot2::geom_density_2d
生成的等高线的坐标。
我需要一个(矩阵的)x/y坐标列表,每个等高线一个。
这应该类似于contourLines
给出的内容,但我无法得到所需的结果。
以下是?stat_density2d
中的一些示例代码:
m <- ggplot(faithful, aes(x = eruptions, y = waiting)) +
geom_point() +
xlim(0.5, 6) +
ylim(40, 110)
m + geom_density_2d()