图不显示

编程入门 行业动态 更新时间:2024-10-19 08:56:42
本文介绍了图不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用闪亮的图形,所以无法显示图形.它是以前出现的,我不知道发生了什么变化.

I'm using shiny and I can't get a plotly graph to appear. It was appearing before, I don't know what changed.

MRE:

global.r(或将其放入server.r)

global.r (or put this into 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

shinydashbaord 0.5.1

shinydashbaord 0.5.1

密谋2.0.16

空环境

我注意到,当我运行上面的代码时,出现错误 Error in gregexpr(calltext, singleline, fixed = TRUE) : regular expression is invalid UTF-8.

I noticed that when I run the above code, I get an error Error in gregexpr(calltext, singleline, fixed = TRUE) : regular expression is invalid UTF-8.

对debug(gregexpr)进行进一步调查后,我看到了

Upon further investigation with debug(gregexpr), I see this

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\")"

不确定该怎么做.真的有一些幕后代码会修改一个字符串,该字符串随后会被评估为函数吗?

not sure what to make of that. Is there really some under-the-hood code that's supposed to be modifying a string that is later evaluated to a function?

我找到了另一个我的程序,该程序的绘图效果很好.从未调用gregrexpr().查看生成的HTML,有问题的HTML具有这种样式

I found another program I have where the plotly graph renders fine. gregrexpr() is never called. Looking at the generated HTML, the problematic one has this under style

width: 100%; height: 400px; visibility: hidden;

可见的有

width: 100%; height: 400px; visibility: inherit;

所以我想这是相关的(尽管因果关系未知...)

so I imagine this is related (though causation direction is unknown...)

推荐答案

renderPlotly({ return(plot_ly(x)) })

坏了.

renderPlotly(plot_ly(x))

有效.

要在绘制绘图之前做更多工作,请做类似的事情

To do more work before rendering the plotly, do something like

renderPlotly(yourFunctThatGeneratesAPlotly(input$Whatever))

更多推荐

图不显示

本文发布于:2023-07-18 12:50:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1144944.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!