Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
RStudio在脱机时不显示绘图_R_Offline_Plotly - Fatal编程技术网

RStudio在脱机时不显示绘图

RStudio在脱机时不显示绘图,r,offline,plotly,R,Offline,Plotly,Plotly in RStudio有时在脱机工作时遇到问题,即没有可用的internet连接时 运行以下脚本不会在RStudio中产生错误,但查看器仍为空。单击在新窗口中显示图标将在Chrome中打开绘图,但不会出现问题 rm(list = ls()) # Clear all variables and data library(plotly) attach(mtcars) p <- plot_ly()%>% add_trace(data = mtcars, x = ~hp,

Plotly in RStudio有时在脱机工作时遇到问题,即没有可用的internet连接时

运行以下脚本不会在RStudio中产生错误,但查看器仍为空。单击
在新窗口中显示
图标将在Chrome中打开绘图,但不会出现问题

rm(list = ls()) # Clear all variables and data
library(plotly)
attach(mtcars)
p <- plot_ly()%>%
    add_trace(data = mtcars, x = ~hp, y = ~mpg,
                     type = "scatter", mode = "lines")
print(p)
rm(list=ls())#清除所有变量和数据
图书馆(绘本)
附加(mtcars)
p%
添加跟踪(数据=mtcars,x=~hp,y=~mpg,
type=“scatter”,mode=“lines”)
印刷品(p)
当我右键单击查看器并选择
Inspect element
时,我在控制台中看到以下错误:

加载资源失败:internet连接似乎处于脱机状态。http://localhost:29217/session/viewhtmlaf0667b0fcf7/index.html?viewer_pane=1

同样,在我的浏览器中打开该链接不会产生错误

为了解决这个问题,我可以连接互联网。之后,即使我再次断开连接,绘图也会显示出来。 然而,由于某些地方缺乏互联网,这种解决方法并不总是可行的

我的设置如下:
-MacBook Pro 5,3
-OS X 10.11.6
-RStudio 1.0.136
-Plotly v4.5.6


您是否支持RStudio不知道的代理(即该代理在浏览器中设置,但不作为环境变量)?我不支持代理。如果我检查Chrome中的设置,它会显示
Google Chrome正在使用您计算机的系统代理设置连接到网络。
检查我的系统代理设置,我发现没有配置代理。然而,在离线(没有wifi,没有以太网)环境中,这又有什么关系呢?我是否需要internet连接才能运行plotly?不,运行它不需要internet连接,毕竟它是在本地主机上运行的。由于公司代理设置,我今天无法卷曲本地主机。我想可能是类似的。在我的例子中,代理重定向所有http请求以“验证”它是否可接受。如果你在公司环境中,通常可以在IE的Internet选项中找到设置。@waterling感谢你与我一起思考。我不在公司环境中,所以这不适用于我。