Why are plotly-rendered graphs not working on Mozilla

馋奶兔 提交于 2019-12-12 09:58:26

问题


I am getting the following error when trying to open an html document put together with knitr in Mozilla Firefox. The error is a result of the graph element composed with the plotly package.

unknownError: error occurred while processing 
'getCachedMessages: out of memory

The entire contents of the rmarkdown file (default everything else):

library(plotly)
library(ggplot2)
theData <- data.frame(A=1:26, B=letters, C=rnorm(26,19))

g<-ggplot(theData, aes(x=A, y=C)) +
  geom_point()
ggplotly(g)

I have the most recent version of Firefox. I don't seem to have trouble viewing other pages with plotly elements on them. The page works in IE, no problem.


回答1:


(apologies - I do not have enough points to respond in comments)

I get same problem with R + Rmd + plotly + Firefox (but no issue with IE or Opera). The following issues have been raised at Github / ropensci / plotly - but no solutions as of 2017-01-20 :

  1. plotly + FlexDashboard + Firefox = huge memory consumption #721
  2. Very bad performance of RMarkdown in Firefox #483
  3. R library: Big slowdown in Firefox but not in Chrome #17 (github / plotly / plotly.js / issues / 17)



回答2:


So far (2018-05-08) it seems that this issue persists. But there is a workaround which cpsievert mentions on GitHub (see camelCase's answer for the links).

You have to add self_contained: false to the YAML header like this:

---
title: "Your title"
output:
  html_document:
    self_contained: false
---

The problem with this hack is that you will no longer have a standalone .html file. Please, see the topic Document Dependencies at https://rmarkdown.rstudio.com/html_document_format.html for more details.



来源:https://stackoverflow.com/questions/41601669/why-are-plotly-rendered-graphs-not-working-on-mozilla

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!