使用R与plotly绘制Weibull概率图时Y轴值设置问题求助
Weibull概率图Y轴数值匹配问题(R+Plotly实现)
我用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
当前生成的图表截图:
内容的提问来源于stack exchange,提问作者Paul Govan
相关产品推荐
相关产品推荐

