【发布时间】:2019-08-26 15:10:43
【问题描述】:
ggplot2::geom_density() 的默认设置与一个小平面和ggridges::geom_density_ridges() 产生略有不同的曲线。如何修改其中一种或另一种平滑技术以产生相同的结果?
library(tidyverse)
library(ggridges)
# standard density with facet by cyl ----
mtcars %>%
ggplot(aes(x = mpg)) +
geom_density(fill = "gray") +
facet_wrap(. ~ factor(cyl, levels = c(8, 6, 4)), ncol = 1) +
theme_minimal()
# density ridge with y = cyl ----
mtcars %>%
ggplot(aes(x = mpg, y = factor(cyl))) +
geom_density_ridges() +
theme_minimal()
#> Picking joint bandwidth of 1.38
由reprex package (v0.2.1) 于 2019 年 4 月 4 日创建
【问题讨论】: