googleVis
googleVis copied to clipboard
No graph output when using googleVIS in Jupyter
Using this works in R console:
plot(G)
but when typed into a cell in jupyter I get:
starting httpd help server ... done
and no graph. So here is what I did. Into Anaconda 2.7.11, I installed R essentials
conda install -c r r-essentials
started up jupyter
notebook jupyter
installed needed reqs, XML and googleVIS, by typing this into a cell
options(repos=structure(c(CRAN="https://cloud.r-project.org/")))
install.packages('googleVis')
install.packages('XML')
typed this code into a 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 into an R console and makes a nice map. But something is causing jupyter to choke on starting a server. I guess since jupyter itself is web page running in a server there is some sort of problem with a web page starting a server?
Hi there,
I don't use Jupyter myself and have therefore no experience, but I guess it good work similar to RMarkdown files.
The help files to plot.gvis and print.gvis have more information and examples on this.
I hop this helps.
Markus
On 12 Jun 2016, at 18:03, stefangeorge [email protected] wrote:
Using this works in R console:
plot(G)
but when typed into a cell in jupyter I get:
starting httpd help server ... done and no graph. So here is what I did. Into Anaconda 2.7.11, I installed R essentials
conda install -c r r-essentials started up jupyter
notebook jupyter installed needed reqs, XML and googleVIS, by typing this into a cell
options(repos=structure(c(CRAN="https://cloud.r-project.org/"))) install.packages('googleVis') install.packages('XML') typed this code into a 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 into an R console and makes a nice map. But something is causing jupyter to choke on starting a server. I guess since jupyter itself is web page running in a server there is some sort of problem with a web page starting a server?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
Jupyter runs in a web browser that accesses a server that python starts on the local machine. I am not familiar with RMarkdown but will look into it. I just like using jupyter because it is so interactive and allows me to use python and R and julia all together.