Jupyter R Plotly 404 eror with sample code -
i tried run plotly r chart in jupyter here , get:
404 not found error.
the code follows
library(plotly) set.seed(123) x <- rnorm(1000) y <- rchisq(1000, df = 1, ncp = 0) group <- sample(letters[1:5], size = 1000, replace = t) size <- sample(1:5, size = 1000, replace = t) ds <- data.frame(x, y, group, size) p <- plot_ly(ds, x = x, y = y, mode = "markers", group = group, size = size) %>% layout(title = "scatter plot") embed_notebook(p,file="/jupyter notebooks/plotlyjupyterhtml/test3.html")
the terminal has error message:
404 /jupyter%20notebooks/plotlyjupyterhtml/test3.html.embed (::1) 6.51ms referer=http://localhost:8888/notebooks/plotly%20%in%20r%20testing-copy1-ipynd
there file in directory d:\jupyter notebooks\plotlyjupyterhtml\test3.html
not 1 additional extension .embed
.
the html file has data , creates correct chart when opened in firefox.
it seems statement may have wrong file name appreciate insight work.
here session info:
session info ------------------------------------------------------------------- packages ----------------------------------------------------------------------- setting value version r version 3.3.1 (2016-06-21) system i386, mingw32 ui rterm language (en) collate english_united states.1252 tz america/new_york date 2016-07-11 package * version date source assertthat 0.1 2013-12-06 cran (r 3.3.1) base64enc 0.1-3 2015-07-28 cran (r 3.3.0) colorspace 1.2-6 2015-03-11 cran (r 3.3.1) devtools 1.12.0 2016-06-24 cran (r 3.3.1) digest 0.6.9 2016-01-08 cran (r 3.3.1) evaluate 0.9 2016-04-29 cran (r 3.3.1) ggplot2 * 2.1.0 2016-03-01 cran (r 3.3.1) gridextra 2.2.1 2016-02-29 cran (r 3.3.1) gtable 0.2.0 2016-02-26 cran (r 3.3.1) htmltools 0.3.5 2016-03-21 cran (r 3.3.1) htmlwidgets 0.6 2016-02-25 cran (r 3.3.1) httr 1.2.1 2016-07-03 cran (r 3.3.1) irdisplay 0.4.1 2016-07-09 github (irkernel/irdisplay@8e24901) irkernel 0.6 2016-07-09 github (irkernel/irkernel@8cdfe5e) jsonlite 1.0 2016-07-01 cran (r 3.3.1) magrittr 1.5 2014-11-22 cran (r 3.3.1) memoise 1.0.0 2016-01-29 cran (r 3.3.1) munsell 0.4.3 2016-02-13 cran (r 3.3.1) pbdzmq 0.2-3 2016-05-20 cran (r 3.3.1) plotly * 3.6.0 2016-05-18 cran (r 3.3.1) plyr 1.8.4 2016-06-08 cran (r 3.3.1) r6 2.1.2 2016-01-26 cran (r 3.3.1) rcpp 0.12.5 2016-05-14 cran (r 3.3.1) repr 0.7 2016-05-13 cran (r 3.3.1) scales 0.4.0 2016-02-26 cran (r 3.3.1) stringi 1.1.1 2016-05-27 cran (r 3.3.0) stringr 1.0.0 2015-04-30 cran (r 3.3.1) tibble 1.1 2016-07-04 cran (r 3.3.1) tidyr 0.5.1 2016-06-14 cran (r 3.3.1) uuid 0.1-2 2015-07-28 cran (r 3.3.0) viridis 0.3.4 2016-03-12 cran (r 3.3.1) withr 1.0.2 2016-06-20 cran (r 3.3.1) yaml 2.1.13 2014-06-12 cran (r 3.3.1)
i had same issue in macos. workaround did,
p <- plot_ly(ds, x = x, y = y, mode = "markers", group = group, size = size) htmlwidgets::savewidget(as.widget(p), "index.html") rawhtml <- paste(readlines("index.html"), collapse="\n") display_html(rawhtml)
this not best solution, time being works me.
Comments
Post a Comment