我正在color为多面直方图添加美感。在下面的 reprex 中,没有颜色美感,直方图仅显示该方面级别内的数据。但是,在color定义的情况下,添加了一个基线,该基线将拉伸范围扩展为包括所有方面的数据范围。有没有办法让这种情况不发生?
我正在寻找类似于geom_densitywith 的东西trim = TRUE,但似乎没有修剪选项geom_histogram。
library(tidyverse)
data <- tibble(a = rchisq(1000, df = 3),
b = rchisq(1000, df = 1),
c = rchisq(1000, df = 10)) %>%
gather()
ggplot(data, aes(x = value)) +
geom_histogram() +
facet_wrap(~ key, ncol = 1)
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Run Code Online (Sandbox Code Playgroud)

ggplot(data, aes(x = value)) +
geom_histogram(color = "red") +
facet_wrap(~ key, ncol = 1)
#> `stat_bin()` using …Run Code Online (Sandbox Code Playgroud)