我试图用R和plotly构建一个Weibull概率图,但无法正确设置y轴值(即绘制的标记与下面示例中给出的位置不对应)。
library(plotly)
time <- c(30, 49, 82, 90, 96)
probability <- c(0.0976, 0.2533, 0.4102, 0.5673, 0.7243)
datum <- c(3.007, 3.777, 4.754, 5.941, 7.472, 9.300, 9.382, 11.811, 14.991, 18.854, 20.968,
23.728, 29.874, 29.924, 37.717, 47.534, 60.232, 76.910, 78.034, 94.931, 98.347,
124.650, 155.927, 195.327, 245.654)
unreliability <- c(0.0010, 0.0016, 0.0025, 0.0040, 0.0064, 0.0100, 0.0102, 0.0162, 0.0256,
0.0405, 0.0500, 0.0638, 0.0996, 0.1000, 0.1538, 0.2336, 0.3453, 0.4906,
0.5000, 0.6321, 0.6584, 0.8193, 0.9344, 0.9869, 0.9990)
log_prob <- log(1/(1-probability))
log_unrel <- log(1/(1-unreliability))
probPlot <- plot_ly(x=time, y=log_prob, type='scatter', mode='markers', showlegend=FALSE) %>%
layout(xaxis = list(type='log'), yaxis = list(type='log')) %>%
add_trace(x=datum, y=log_unrel, mode='lines',
marker=list(color='transparent'))
probPlot
字符串
的数据
1条答案
按热度按时间sczxawaw1#
我不熟悉plotly,但
WeibullR
包中的p2y()
函数可能会有所帮助。从the documentation,这将应用逆累积分布函数(。. .)在向wblr对象上生成的图添加点和线时,它特别方便。