3

ggplot2::geom_density()with a facetのデフォルト設定では、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 パッケージ(v0.2.1)によって 2019-04-04 に作成

4

1 に答える 1