【发布时间】:2019-05-04 06:42:26
【问题描述】:
使用带有stat_density2d 的轮廓会出错:
ggplot(faithful, aes(x = eruptions, y = waiting, fill = ..density..)) +
stat_density2d(geom = "tile")
不知道如何为对象类型自动选择比例 功能。默认为连续。 is.finite(x) 中的错误:默认 没有为“闭包”类型实现方法
使用contour = F 绘制没有错误。问题是什么?
【问题讨论】:
-
在文档here 中,在
stat_density_2d(geom = "raster", aes(fill = stat(density)), contour = FALSE)之前有一个注释# If we turn contouring off, we can use use geoms like tiles。不过,我不清楚为什么。 -
要绘制轮廓,您需要中断,而瓷砖/栅格是连续的。一个 stat/geom 永远不会绘制超过一个 geom,所以如果你想要颜色和线条,请拨打两个电话。 (第二行,所以它们会在最上面。)如果你想要填充的行,请查看 metR 包,它以这种方式做了一些非常酷的事情。
-
@alistaire 你能发帖回答吗?