简体   繁体   English

如何使用Plotly可视化正态分布图?

[英]How to visualize Normal Distribution Plot using Plotly?

Plot- Normal Distribution chart (Six Sigma) Package- Plotly 图解-正态分布图(六西格玛)封装-图解

I have tried something like this but it is not working 我已经尝试过类似的方法,但是它不起作用

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))

Use corrlY Package 使用corrlY包

# download package from 
devtools::install_github("maheshKulkarniX/corrlY")
library(corrlY)
normal_distribution(data = mtcars, parameter = mtcars$mpg, xname = "MPG")

You Can see a realtime example on this link Normal Distribution Chart Using R Plotly 您可以在此链接上看到一个实时示例,其中正态分布图使用R Plotly

Github Repository link Corrly- Data Visualization Package using plotly which provides all types of statistical Charts Github Repository链接Corrly-数据可视化包,使用plotly提供所有类型的统计图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM