r - No graph output when using googleVIS in jupyter -
using works in r console:
plot(g)
but when typed cell in jupyter get:
starting httpd server ... done
and no graph. here did. anaconda 2.7.11, installed r essentials
conda install -c r r-essentials
started jupyter
notebook jupyter
installed needed reqs, xml , googlevis, typing cell
options(repos=structure(c(cran="https://cloud.r-project.org/"))) install.packages('googlevis') install.packages('xml')
typed code cell
suppresspackagestartupmessages(library(googlevis)) library(googlevis) library(xml) url <- "http://en.wikipedia.org/wiki/list_of_countries_by_credit_rating" x <- readhtmltable(readlines(url), which=3) levels(x$rating) <- substring(levels(x$rating), 4, nchar(levels(x$rating))) x$ranking <- x$rating levels(x$ranking) <- nlevels(x$rating):1 x$ranking <- as.character(x$ranking) x$rating <- paste(x$country, x$rating, sep=": ") g <- gvisgeochart(x, "country", "ranking", hovervar="rating", options=list(gvis.editor="s&p", projection="kavrayskiy-vii", coloraxis="{colors:['#91bfdb', '#fc8d59']}"))
then
plot(g)
this code works fine when typed directly r console , makes nice map. causing jupyter choke on starting server. guess since jupyter web page running in server there sort of problem web page starting server?
i have same issue. according this demonstration, need in r console additionally add line after loading library:
library(googlevis) op <- options(gvis.plot.tag='chart')
the introduction of tag
can found here in googlevis's documentation. after trying in jupyter got block of .json data , cannot compile interactive graph.
hope in anyway. try plotly
, work on jupyter
.
Comments
Post a Comment