你需要为他们的情节对手换掉一些基本的闪亮功能.即plotOutput
- > plotlyOutput
和renderPlot
- > renderPlotly
.此外,最后一个plot(p)
不是你想要返回的:你只想返回p
(绘图对象).
require(shiny) require(plotly) Trial <- read.table("http://history.emory.edu/RAVINA/Aozora/Data/Trial.txt", row.names = 1) ui <- fluidPage( titlePanel("Word Frequency Analysis for Meiji-era Authors"), mainPanel( plotlyOutput("plot"), dataTableOutput("Print") ) ) server <- function(input, output){ output$plot<-renderPlotly({ p <- plot_ly(Trial, x=V1, y=V2, text=rownames(Trial), mode = "text") #plot(p) p }) output$Print<-renderDataTable({Trial}) } shinyApp(ui = ui, server = server)