R 如何使用图层功能更改直方图的宽度

R 如何使用图层功能更改直方图的宽度,r,ggplot2,histogram,layer,R,Ggplot2,Histogram,Layer,我尝试从rlnorm(100)创建的100个随机数中使用ggplot2的层函数制作直方图 到目前为止,这是我的代码 library(ggplot2) verdeling <- rlnorm(100) verdeling <- as.data.frame(verdeling) verdeling$num <- verdeling$verdeling joost$verdeling <- verdeling$num p <- ggplot(data = verd

我尝试从rlnorm(100)创建的100个随机数中使用ggplot2的层函数制作直方图

到目前为止,这是我的代码

library(ggplot2)
verdeling <- rlnorm(100)
verdeling <- as.data.frame(verdeling)
verdeling$num <- verdeling$verdeling
joost$verdeling <- verdeling$num
    p <- ggplot(data = verdeling, mapping = aes(x = num))


    p2 <- p + layer(
      geom = "bar",
      stat = "bin",
      position = "stack",



    )
    p2
库(ggplot2)

verdeling使用
功能时,将附加参数作为列表传递给
参数

p2 <- p + layer(
    geom = "bar",
    stat = "bin",
    position = "stack",
    # Add binwidth = x as a list to params
    params = list(binwidth = x)
)
p2