Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/24.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
R 在Linux中将ggplot2对象另存为ggplotly并保存到磁盘_R_Linux_Ggplot2_Plotly - Fatal编程技术网

R 在Linux中将ggplot2对象另存为ggplotly并保存到磁盘

R 在Linux中将ggplot2对象另存为ggplotly并保存到磁盘,r,linux,ggplot2,plotly,R,Linux,Ggplot2,Plotly,正在尝试在R中使用plotly迈出第一步 我想将我的ggplot2对象转换为ggplotly对象,然后在Linux平台上将其另存为html。我希望能够从命令行调用此R代码并将其作为脚本执行,而不是通过RStudio运行它 我以为这样就可以了 然后我安装了XQuartz,以便能够ssh-X-Y从我的Mac到我的linux系统 ggiris.ly <- ggplotly(ggiris) 抛出此错误: Error in .External2(C_X11, paste("png::", file

正在尝试在
R
中使用
plotly
迈出第一步

我想将我的
ggplot2
对象转换为
ggplotly
对象,然后在
Linux
平台上将其另存为
html
。我希望能够从命令行调用此R代码并将其作为脚本执行,而不是通过
RStudio
运行它

我以为这样就可以了

然后我安装了
XQuartz
,以便能够
ssh-X-Y
从我的
Mac
到我的
linux
系统

ggiris.ly <- ggplotly(ggiris)
抛出此错误:

Error in .External2(C_X11, paste("png::", filename, sep = ""), g$width,  :
  unable to start device PNG
In addition: Warning message:
In dev_fun(tmpPlotFile, width = deviceWidth, height = deviceHeight) :
  unable to open connection to X11 display ''
Error in htmlwidgets::saveWidget(ggiris.ly, "~/Downloads/ggiris.html") : 
  Saving a widget with selfcontained = TRUE requires pandoc. For details see:
https://github.com/rstudio/rmarkdown/blob/master/PANDOC.md
有什么想法吗

顺便说一句,
我正在使用
plotly_4.5.6
ggplot2_2.2.1
我确保在从Mac到远程服务器的
ssh-X
过程中没有打开
防火墙


然后执行上面的代码时没有任何警告。(打开一个空的图形设备,可以创建一个空白的
Rplot.pdf
文件)。

从Mac到远程服务器时,我确保没有打开
防火墙


然后执行上面的代码时没有任何警告。(打开一个空的图形设备,创建一个空白的
Rplot.pdf
文件除外)。

您需要在系统上安装pandoc。运行
sudo apt get install pandoc
,或者如果您没有root访问权限,请让您的系统管理员这样做


或者,您可以使用
htmlwidgets::saveWidget(h,“test.html”,selfcontained=FALSE)进行保存

您需要在系统上安装pandoc。运行
sudo apt get install pandoc
,或者如果您没有root访问权限,请让您的系统管理员这样做


或者,您可以使用
htmlwidgets::saveWidget(h,“test.html”,selfcontained=FALSE)进行保存。

谢谢。我注意到并修复了它,但错误与此无关。已修复。再次感谢。在Win7上使用相同版本也可以,在Mac上也可以。这个问题是特定于Linuxnot fix的,但需要解决…创建一个rMarkdown对象,其中除了绘图之外没有其他内容…您将拥有一个交互式html文档谢谢。我注意到并修复了它,但错误与此无关。已修复。再次感谢。在Win7上使用相同版本也可以,在Mac上也可以。这个问题是特定于Linuxnot fix的,但需要解决…创建一个rMarkdown对象,其中除了绘图外没有其他内容…您将安装一个交互式html文档PandoInstalled pandoc
htmlwidgets::saveWidget(ggiris.ly,"~/Downloads/ggiris.html")
Error in htmlwidgets::saveWidget(ggiris.ly, "~/Downloads/ggiris.html") : 
  Saving a widget with selfcontained = TRUE requires pandoc. For details see:
https://github.com/rstudio/rmarkdown/blob/master/PANDOC.md