我正在使用闪亮的,但无法显示绘图。之前就出现过,不知道怎么变了。
MRE:
global.r(或将其放入 server.r 中)
library(shinydashboard)
library(plotly)
server.r
shinyServer(function(input, output, session) {
output$plotlyGraph <- renderPlotly({
input$regraph
print("graphing...")
return(plot_ly(list(blank = 0)))
})
})
ui.r
dashboardPage(
dashboardHeader(title = "The Title"),
dashboardSidebar(
actionButton("regraph", "graph again")
),
dashboardBody(
box(plotlyOutput("plotlyGraph"))
)
)
R版本3.2.3
闪亮版本13.0
闪亮仪表板0.5.1
情节2.0.16
空旷的环境
我注意到当我运行上面的代码时,出现错误
Error in gregexpr(calltext, singleline, fixed = TRUE) : regular expression is invalid UTF-8.
经进一步调查debug(gregexpr)
,我看到这个
Called from: inherits(x, "ggplot")
debugging in: gregexpr(calltext, singleline, fixed = TRUE)
debug: {
if (!is.character(text))
text <- as.character(text)
.Internal(gregexpr(as.character(pattern), text, ignore.case,
perl, fixed, useBytes))
}
Browse[2]> text
[1] "function (x) inherits(x, \"ggplot\")"
不知道该怎么做。是否真的有一些幕后代码应该修改稍后评估为函数的字符串?
我发现了另一个程序,其中绘图渲染得很好。 grgreexpr() 永远不会被调用。查看生成的 HTML,有问题的 HTML 样式如下
width: 100%; height: 400px; visibility: hidden;
而可见的有
width: 100%; height: 400px; visibility: inherit;
所以我想这是相关的(尽管因果方向未知......)