我在闪亮的应用程序中巧妙地使用了 R 包。这是一个小例子:
library(shiny)
library(plotly)
ui <- fluidPage(
plotlyOutput("plot"),
verbatimTextOutput("event")
)
server <- function(input, output) {
# renderPlotly() also understands ggplot2 objects!
output$plot <- renderPlotly({
plot_ly(mtcars, x = ~mpg, y = ~wt)
})
output$event <- renderPrint({
d <- event_data("plotly_hover")
if (is.null(d)) "Hover on a point!" else d
})
}
shinyApp(ui, server)
如何通过例如“ResultDNA(27)”更改名称“newplot(27)”
谢谢。
目前有两种解决方案:
通过在 plotly 中使用导出功能
App1 <- plot_ly()
export(App1, file = "ResultDNA(27).png")
您可以首先将图像保存在 HTML 中,然后使用 htmlwidgets 保存为所需的格式
App2 <- plot_ly(...)
htmlwidgets::saveWidget(App2, file = "ResultDNA(27).html")
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句