在R中以HTML格式导出图时错误
当尝试使用绘图图绘制图形并使用 savewidget
:'选项'必须是完全命名的列表,或者没有名称(null)
时,我会遇到此错误。这是我绘制和保存图形的方式:
Age <-c(69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183)
Pertubation <- c(0.002967936,-0.794788368,-1.561544673,-2.938300977,-2.956057282,-3.724813586,-3.84656989,-4.000326195,-3.491082499,-3.705838803,-3.008595108,-3.439351412,-2.518107716,-2.108864021,-1.892620325,-2.175376629,-2.547132934,-2.694889238,-3.985645543,-2.702401847,-3.203158151,-3.238914456,-2.60867076,-2.564427064,-3.254183369,-1.973939673,-0.731695977,-0.625452282,-0.966208586,-0.811964891,-0.018721195,0.320522501,-0.227233804,-0.046990108,-0.820746412,-0.846502717,1.067740979,1.470984675,1.00222837,0.448472066,1.139715762,1.275959457,0.989203153,0.904446848,0.607690544,0.20693424,1.084177935,1.114421631,0.625665327,0.292909022,-0.833847282,-2.208603586,-3.397359891,-4.339116195,-4.950872499,-5.518628804,-6.992385108,-7.023141413,-8.193897717,-8.580654021,-9.428410326,-10.92316663,-11.37392293,-12.21167924,-12.77643554,-13.14219185,-13.67394815,-14.19370446,-14.16046076,-15.29121706,-16.06197337,-16.11472967,-16.29348598,-17.62424228,-17.79699859,-19.42675489,-19.6625112,-20.3642675,-21.4460238,-22.05378011,-23.87553641,-24.06129272,-25.00604902,-25.80180533,-26.77656163,-27.40431793,-28.86407424,-29.45483054,-29.37758685,-30.48534315,-30.07209946,-29.86985576,-29.82561207,-30.46936837,-30.56412467,-30.24788098,-29.40463728,-29.76939359,-29.11314989,-29.0989062,-29.2466625,-29.1654188,-29.28217511,-29.11493141,-28.44568772,-28.65344402,-28.43520033,-28.71795663,-29.06871293,-29.66546924,-28.39422554,-29.68398185,-29.73973815,-29.34349446,-29.45325076)
temp <- cbind(Age, Pertubation)
Pertubation_graph <- plot_ly(data.frame(temp), x = ~Age, y = ~res,
cex.main = 1.5, cex.lab = 1.2, axes = F) %>%
layout(title = paste( "Pig ID:", i, ", Lambda =", lambda, "\nDifference between CFI and TTC"),mtext("Percentage of difference: CFI - TTC (%)", side=4, line = 3, cex = 1.2, col= "blue"), plot_bgcolor = "fffff", xaxis = list(title = 'Age (d)'),
yaxis = list(title = 'Amount of difference: CFI - TTC (kg)'),type = "p", pch = 10, cex = 0.5,
ylim = c(min(B$dif.CFI, res), max(B$dif.CFI, res)), cex.main = 1.5, cex.lab = 1.2, axes = F)
Pertubation_graph <- Pertubation_graph %>% layout(axis(1, at= seq(dif$eval_day[1],dif$eval_day[length(dif$eval_day)], by = 5), cex.axis = 1.1),
axis(2, at=, cex.axis = 1.1),
axis(4, at=, cex.axis = 1.1, col.axis = "blue", col = "blue"),
abline(crit1,0, col = "red", lty = 2) ,
abline(0,0, col = "red"))
saveWidget(ggplotly(Pertubation_graph), file=paste0("C:/Users/Kevin Le/PycharmProjects/Pig Data Black Box/Graphs/Step3_graphs/", idc, ".", ID[idc], ".html"))
有人可以帮我吗?提前感谢大家。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论