我想在直方图上叠加一个直方图边界,但它们不在正确的位置
library(tidyverse)
data("iris")
iris %>%
ggplot(
aes(Sepal.Length)
) +
geom_histogram(
alpha = .5
) +
stat_bin(geom="step") +
facet_wrap(
~Species, ncol = 1
)返回

如何将边框与直方图对齐?
发布于 2020-02-22 04:03:27
这可以通过指定binwidth,然后设置breaks来完成
library(tidyverse)
data("iris")
iris %>%
ggplot( aes(Sepal.Length)) +
geom_histogram(alpha = .5, binwidth = .1) +
stat_bin(geom="step", breaks = seq(3,8, .1)) +
facet_wrap( ~Species, ncol = 1)

https://stackoverflow.com/questions/60345288
复制相似问题