图-正态分布图(六西格玛) 打包地
我已经尝试过类似的方法,但是它不起作用
library(plotly)
y <- rgamma(1000, shape = 0.25, rate = 0.0054)
dens <- data.frame(x = density(y)$x, y = density(y)$y)
miny <- 0
maxy <- max(dens$y)
plot_ly() %>%
add_histogram(x = y) %>%
add_lines(data = dens, x = ~x, y = ~y, yaxis = "y2", line = list(width = 3)) %>% layout(yaxis2 = list(overlaying = "y", side = "right", range = c(miny, maxy), showgrid = F, zeroline = F))
答案 0 :(得分:0)
使用corrlY软件包
# download package from
devtools::install_github("maheshKulkarniX/corrlY")
library(corrlY)
normal_distribution(data = mtcars, parameter = mtcars$mpg, xname = "MPG")
您可以在此链接上看到一个实时示例 Normal Distribution Chart Using R Plotly
Github存储库链接Corrly- Data Visualization Package using plotly which provides all types of statistical Charts